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. Argument variable






2. exponent AND assignment operator






3. floor division AND assignment operator






4. prints its parameter to the console






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






6. exponentiation






7. Binary AND Operator copies a bit to the result if it exists in both operands. (a & b) will give 12 which is 0000 1100






8. This statement causes an exception.






9. exponentiation






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






11. single line comment






12. Function to write something to a file






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






14. modulus AND assignment operator






15. floor division






16. Function to open or read a file






17. Adds something to a variable






18. 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






19. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101






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






21. A statement that breaks out of a loop.






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






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






24. Holds the value of something - e.g. oh_hi = 4 where oh_hi is the variable.






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






26. Adds a new line character






27. Greater than symbol






28. Function to write something to a file






29. adds an item to a list






30. Less than symbol






31. This keyword begins the simplest form of a conditional statement.






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






33. Less than or equal to symbol






34. 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).






35. Symbol to divide by the number to the right of the symbol






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






37. Writes stuff to the file.






38. Function to empty the contents of a file - no recovery is possible






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






40. adds an item to a list






41. deletes an item from a list






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






43. floor division






44. A logical operator which negates an expression so that it returns a value of True if the expression is false.






45. An operator to check whether two variables refer to the same object.






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






47. Reads just one line of a text file.






48. asks the user for a response and returns that response






49. Adds something to a variable






50. turns an object into a string