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. Modulus operator. It's the remainder after division






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






3. Prints a string to the screen which is a signed decimal.






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






5. Argument variable






6. Adds something to a variable






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






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






9. Symbol to subtract things from each other






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






11. Create a variable.






12. Less than or equal to symbol






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






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






15. modulus AND assignment operator






16. add AND assignment operator






17. empties the file






18. adds an item to a list






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






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






21. Function to open or read a file






22. exponentiation






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






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






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






26. unction to read one line of a file






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






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






29. Create a variable.






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






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






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






33. Less than or equal to symbol






34. single line comment






35. assignment operator






36. subtract AND assignment operator






37. modulo






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






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






40. floor division AND assignment operator






41. Symbol to add things together






42. Reads just one line of a text file.






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






44. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011






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






46. turns an object into an integer






47. sets the file's current position






48. Greater than or equal symbol.






49. Prints a string to the screen which is a signed decimal.






50. Adds a new line character