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. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.






2. Symbol to add things together






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






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






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






6. Adds a new line character






7. absolute value






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






9. floor division






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






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






12. square root






13. subtract AND assignment operator






14. sets the file's current position






15. modulus AND assignment operator






16. floor division AND assignment operator






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






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






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






20. Less than symbol






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






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






23. This statement causes an exception.






24. turns an object into an integer






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






26. Argument variable






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






28. Argument variable






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






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






31. End header line.






32. multiply AND assignment operator






33. exponent AND assignment operator






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






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






36. Symbol to add things together






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






38. Writes stuff to the file.






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






40. Symbol to subtract things from each other






41. Less than symbol






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






43. Greater than symbol






44. divide AND assignment operator






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






46. Less than or equal to symbol






47. Where the parameters go. A necessary punctuation after any function even if it's empty.






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






49. modulus AND assignment operator






50. The extension for Python scripts