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. This statement causes an exception.






2. Argument variable






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






4. assignment operator






5. sets the file's current position






6. modulo






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






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






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






10. Less than symbol






11. Symbol used to create comments






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






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






14. A statement that displays a value on the screen.






15. deletes an item from a list






16. Function to write something to a file






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






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






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






20. The extension for Python scripts






21. exponent AND assignment operator






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






23. Greater than symbol






24. Adds something to a variable






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






26. turns an object into an integer






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






28. square root






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






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






31. turns an object into a string






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






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






34. Create a variable.






35. divide AND assignment operator






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






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






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






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






40. Command to print to the screen






41. A statement that assigns a value to a variable.






42. turns an object into a string






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






44. unction to read one line of a file






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






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






47. floor division AND assignment operator






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






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






50. Function to read the contents of a file