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 write something to a file






2. Function to read the contents of a file






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






4. prints its parameter to the console






5. inserts an item inside a list at a certain index






6. A statement that breaks out of a loop.






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






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






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






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






11. Function to read the contents of a file






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






13. modulo






14. Function to open or read a file






15. multiply AND assignment operator






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






17. prints its parameter to the console






18. multiply AND assignment operator






19. assignment operator






20. Create a variable.






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






22. Symbol to add things together






23. Create a variable.






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






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






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






27. unction to read one line of a file






28. adds an item to a list






29. Greater than or equal symbol.






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






31. divide AND assignment operator






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






33. absolute value






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






35. floor division AND assignment operator






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






37. Function to open or read a file






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






39. single line comment






40. exponentiation






41. Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y - here not in results in a 1 if x is a member of sequence y.






42. Symbol to multiply things






43. modulus AND assignment operator






44. Writes stuff to the file.






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






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






47. floor division






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






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






50. Command to print to the screen