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. This statement causes an exception.






2. Prevents a runtime error from stopping the program.






3. unction to read one line of a file






4. The extension for Python scripts






5. Symbol to subtract things from each other






6. divide AND assignment operator






7. End header line.






8. The extension for Python scripts






9. Symbol to add things together






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






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






12. Reads just one line of a text file.






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






14. assignment operator






15. empties the file






16. multiply AND assignment operator






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






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






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






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






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






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






23. absolute value






24. writes stuff to the file






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






26. subtract AND assignment operator






27. single line comment






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






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






30. Argument variable






31. sets the file's current position






32. Symbol used to create comments






33. A statement that breaks out of a loop.






34. square root






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






36. assignment operator






37. Less than or equal to symbol






38. exponent AND assignment operator






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






40. turns an object into a string






41. This keyword in the body of a conditional allows chained conditionals.






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






43. turns an object into an integer






44. Function to read the contents of a file






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






46. Symbol to subtract things from each other






47. Create a variable.






48. Function to write something to a file






49. Function to write something to a file






50. Command to print to the screen