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. Less than or equal to symbol






2. empties the file






3. Adds something to a variable






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






5. An operator to check whether two variables refer to the same object.






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






7. divide AND assignment operator






8. Function to open or read a file






9. Reads just one line of a text file.






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






11. Writes stuff to the file.






12. adds an item to a list






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






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






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






16. turns an object into a string






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






18. Argument variable






19. unction to read one line of a file






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






21. Less than or equal to symbol






22. Symbol used to create comments






23. Prevents a runtime error from stopping the program.






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






25. A statement that ends the current iteration of a loop but continues looping.






26. Function to read the contents of a file






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






28. add AND assignment operator






29. modulo






30. turns an object into an integer






31. Less than symbol






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






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






34. A keyword that does nothing but fill space to indicate code which will be written later.






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






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






37. deletes an item from a list






38. unction to read one line of a file






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






40. exponentiation






41. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. x is not y - here is not results in 1 if id(x) is not equal to id(y).






42. absolute value






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






44. prints its parameter to the console






45. floor division AND assignment operator






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






47. adds an item to a list






48. writes stuff to the file






49. multiply AND assignment operator






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