Test your basic knowledge |

Basic Python Programming

Subject : it-skills
Instructions:
  • Answer 50 questions in 15 minutes.
  • If you are not ready to take this test, you can study here.
  • Match each statement with the correct term.
  • Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.

This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. a << 2 will give 240 which is 1111 0000






2. Where the parameters go. A necessary punctuation after any function even if it's empty.






3. assignment operator






4. writes stuff to the file






5. Greater than symbol






6. exponentiation






7. This keyword in the body of a conditional - gives an alternative execution.






8. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. x is not y - here is not results in 1 if id(x) is not equal to id(y).






9. Create a variable.






10. Symbol to subtract things from each other






11. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011






12. A statement that breaks out of a loop.






13. A logical operator which compares two operands and produces True if they are equal and False otherwise






14. modulo






15. A built-in function that converts its argument to a string.






16. Symbol to add things together






17. Evaluates to true if it finds a variable in the specified sequence and false otherwise. x in y - here in results in a 1 if x is a member of sequence y.






18. Function to open or read a file






19. Adds something to a variable






20. Binary XOR Operator copies the bit if it is set in one operand but not both. (a ^ b) will give 49 which is 0011 0001






21. Prints a string to the screen which will be Unicode.






22. inserts an item inside a list at a certain index






23. The keyword beginning a header that will create a new function.






24. multiply AND assignment operator






25. Adds something to a variable






26. A keyword that does nothing but fill space to indicate code which will be written later.






27. Prevents a runtime error from stopping the program.






28. adds an item to a list






29. multiply AND assignment operator






30. divide AND assignment operator






31. Binary XOR Operator copies the bit if it is set in one operand but not both. (a ^ b) will give 49 which is 0011 0001






32. modulus AND assignment operator






33. Prints a string to the screen which is converted using repr()






34. Reads the contents of the file you can assign the result to a variable.






35. End header line.






36. single line comment






37. This statement exits a function. The remaining lines of the function are not executed.






38. Symbol to subtract things from each other






39. reads just one line of a text file & keeps track of where in the file you're at






40. empties the file






41. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.






42. absolute value






43. deletes an item from a list






44. This keyword attempts to do something that would cause the program to crash if it were not for this statement.






45. Less than or equal to symbol






46. unction to read one line of a file






47. A logical operator which requires two expressions to both be true.






48. Greater than or equal symbol.






49. Argument variable






50. floor division AND assignment operator