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. absolute value






2. Writes stuff to the file.






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






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






5. assignment operator






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






7. subtract AND assignment operator






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






9. deletes an item from a list






10. Adds something to a variable






11. Function to write something to a file






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






13. divide AND assignment operator






14. Prevents a runtime error from stopping the program.






15. Less than symbol






16. adds an item to a list






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






18. Adds a new line character






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






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






21. floor division






22. square root






23. Function to open or read a file






24. multiply AND assignment operator






25. Command to print to the screen






26. Function to open or read a file






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






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






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






30. Argument variable






31. Symbol used to create comments






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






33. floor division






34. A statement that breaks out of a loop.






35. Greater than symbol






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






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






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






39. Function to read the contents of a file






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






41. Symbol to subtract things from each other






42. prints its parameter to the console






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






44. single line comment






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






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






47. Greater than symbol






48. Greater than or equal symbol.






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






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