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 extension for Python scripts






2. Less than symbol






3. turns an object into an integer






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






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






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






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






8. unction to read one line of a file






9. exponent AND assignment operator






10. adds an item to a list






11. Adds a new line character






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






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






14. square root






15. sets the file's current position






16. Symbol to multiply things






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






18. Create a variable.






19. prints its parameter to the console






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






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






22. Argument variable






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






24. divide AND assignment operator






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






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






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






28. absolute value






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






30. add AND assignment operator






31. exponent AND assignment operator






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






33. Less than or equal to symbol






34. Symbol to subtract things from each other






35. subtract AND assignment operator






36. turns an object into a string






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






38. This keyword begins the simplest form of a conditional statement.






39. deletes an item from a list






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






41. divide AND assignment operator






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






43. Function to open or read a file






44. square root






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






46. Function to write something to a file






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






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






49. multiply AND assignment operator






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