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. Function to open or read a file






2. Greater than or equal symbol.






3. writes stuff to the file






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






5. add AND assignment operator






6. rounds a number to the number of decimal points you choose






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






8. subtract AND assignment operator






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






10. This statement exits a function. The remaining lines of the function are not executed.






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






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






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






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






15. floor division






16. Symbol to subtract things from each other






17. End header line.






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






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






20. A built-in function that converts integers and strings to floating-point numbers.






21. Argument variable






22. subtract AND assignment operator






23. Function to write something to a file






24. Symbol to add things together






25. Reads just one line of a text file.






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






27. Greater than symbol






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






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






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






31. Symbol to add things together






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






33. Function to read the contents of a file






34. absolute value






35. floor division






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






37. Create a variable.






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






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






40. divide AND assignment operator






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






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






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






44. floor division AND assignment operator






45. modulo






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






47. exponent AND assignment operator






48. modulus AND assignment operator






49. exponentiation






50. This keyword in the body of a conditional allows chained conditionals.