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. Function to open or read a file






2. Create a variable.






3. turns an object into an integer






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






5. Writes stuff to the file.






6. This statement causes an exception.






7. subtract AND assignment operator






8. Symbol to add things together






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






10. modulo






11. divide AND assignment operator






12. sets the file's current position






13. The extension for Python scripts






14. rounds a number to the number of decimal points you choose






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






16. Function to read the contents of a file






17. add AND assignment operator






18. Adds something to a variable






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






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






21. Symbol to multiply things






22. A data type for representing numbers with fractional values.






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






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






25. Command to print to the screen






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






27. This keyword creates a new class object which is a user-defined type - like a factory for creating objects.






28. floor division






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






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






31. square root






32. Empties the file - watch out if you care about the file.






33. Create a variable.






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






35. Less than or equal to symbol






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






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






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






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






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






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






42. Symbol to subtract things from each other






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






44. The keyword beginning a header that will create a loop.






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






46. returns the length of a string (number of characters)






47. deletes an item from a list






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






49. assignment operator






50. add AND assignment operator