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. divide AND assignment operator






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






3. subtract AND assignment operator






4. assignment operator






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






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






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






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






9. Argument variable






10. A statement that breaks out of a loop.






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






12. 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).






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






14. turns an object into an integer






15. square root






16. divide AND assignment operator






17. The extension for Python scripts






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






19. unction to read one line of a file






20. prints its parameter to the console






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






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






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






24. Writes stuff to the file.






25. Function to open or read a file






26. floor division






27. modulo






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






29. turns an object into a string






30. End header line.






31. assignment operator






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






33. adds an item to a list






34. Create a variable.






35. add AND assignment operator






36. Function to write something to a file






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






38. multiply AND assignment operator






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






40. Less than or equal to symbol






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






42. deletes an item from a list






43. Function to open or read a file






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






45. floor division AND assignment operator






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






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






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






49. This statement causes an exception.






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