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. The keyword beginning a header that will create a new function.






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






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






4. modulus AND assignment operator






5. Less than or equal to symbol






6. multiply AND assignment operator






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






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






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






10. Function to open or read a file






11. absolute value






12. assignment operator






13. Symbol to subtract things from each other






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






15. A boolean operator that takes two strings and returns True if the first appears as a substring in the second.






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






17. writes stuff to the file






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






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






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






21. unction to read one line of a file






22. Prevents a runtime error from stopping the program.






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






24. floor division AND assignment operator






25. Symbol to subtract things from each other






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






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






28. Symbol to multiply things






29. Function to open or read a file






30. Less than symbol






31. Less than symbol






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






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






34. turns an object into an integer






35. turns an object into a string






36. divide AND assignment operator






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






38. Function to read the contents of a file






39. turns an object into a string






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






41. Adds a new line character






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






43. Symbol to add things together






44. Command to print to the screen






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






46. modulo






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






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






49. Symbol used to create comments






50. subtract AND assignment operator