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. A data type for representing numbers with fractional values.






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






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






4. Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. a >> 2 will give 15 which is 0000 1111






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






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






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






8. End header line.






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






10. Turns a line into a comment instead of executable code.






11. This variable holds the arguments you pass to your Python script when you run it. Then you unpack it in your script so you have variables you can work with.






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






13. Function to write something to a file






14. Modulus operator. It's the remainder after division






15. subtract AND assignment operator






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






17. deletes an item from a list






18. Greater than or equal symbol.






19. deletes an item from a list






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. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011






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






23. prints its parameter to the console






24. absolute value






25. Prevents a runtime error from stopping the program.






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






27. Less than symbol






28. floor division AND assignment operator






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






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






31. Greater than or equal symbol.






32. Function to read the contents of a file






33. Called Logical AND operator. If both the operands are true then then condition becomes true. (a and b) is true.






34. A logical operator which returns a value of True if either of the conditions is true.






35. An operator that removes a value from a list.






36. subtract AND assignment operator






37. Command to print to the screen






38. Symbol to multiply things






39. Function to close a file - it will not be able to be used again unless the file is opened.






40. Prints a string to the screen which is a signed decimal.






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






42. A statement that displays a value on the screen.






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






44. Symbol to add things together






45. divide AND assignment operator






46. absolute value






47. add AND assignment operator






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






49. Argument variable






50. Less than or equal to symbol