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. reads just one line of a text file & keeps track of where in the file you're at






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






3. turns an object into an integer






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






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






6. Function to open or read a file






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






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






9. sets the file's current position






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






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






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






13. Command to print to the screen






14. adds an item to a list






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






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






17. Called Logical AND operator. If both the operands are true then then condition becomes true. (a and b) is true.






18. exponent AND assignment operator






19. Greater than or equal symbol.






20. Function to open or read a file






21. absolute value






22. Argument variable






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






24. multiply AND assignment operator






25. multiply AND assignment operator






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






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






28. empties the file






29. exponentiation






30. Symbol to subtract things from each other






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






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






33. exponentiation






34. Prevents a runtime error from stopping the program.






35. Function to write something to a file






36. This statement causes an exception.






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






38. add AND assignment operator






39. floor division






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






41. Function to read the contents of a file






42. Argument variable






43. assignment operator






44. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.






45. Symbol to multiply things






46. Adds something to a variable






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






48. writes stuff to the file






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






50. The extension for Python scripts