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. floor division






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






3. Symbol to subtract things from each other






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






5. This statement causes an exception.






6. divide AND assignment operator






7. absolute value






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






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






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






11. End header line.






12. Create a variable.






13. Reads just one line of a text file.






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






15. add AND assignment operator






16. Argument variable






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






18. prints its parameter to the console






19. exponent AND assignment operator






20. Function to read the contents of a file






21. modulo






22. This keyword begins a header for a body that repeats until the condition is no longer true.






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






24. turns an object into a string






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






26. Symbol to add things together






27. The extension for Python scripts






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






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






30. multiply AND assignment operator






31. Less than or equal to symbol






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






33. absolute value






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






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






36. square root






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






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






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






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






41. A statement that assigns a value to a variable.






42. multiply AND assignment operator






43. subtract AND assignment operator






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






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






46. writes stuff to the file






47. turns an object into an integer






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






49. A built-in function that converts integers and strings to floating-point numbers.






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