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. returns the length of a string (number of characters)






2. Less than symbol






3. subtract AND assignment operator






4. Adds something to a variable






5. add AND assignment operator






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






7. reads just one line of a text file & keeps track of where in the file you're at






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






9. empties the file






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






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






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






13. unction to read one line of a file






14. modulo






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






16. Less than or equal to symbol






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






18. Command to print to the screen






19. divide AND assignment operator






20. End header line.






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






22. Function to read the contents of a file






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






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






25. Symbol used to create comments






26. floor division AND assignment operator






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






28. subtract AND assignment operator






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






30. absolute value






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






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






33. A statement that breaks out of a loop.






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






35. writes stuff to the file






36. Function to write something to a file






37. exponent AND assignment operator






38. exponent AND assignment operator






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






40. multiply AND assignment operator






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






42. Adds a new line character






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






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






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






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






47. A string that begins with the % symbol and contains a sequence of printable characters and format specifiers that determine how values output should look.






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






49. Argument variable






50. add AND assignment operator