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






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






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






4. Symbol to multiply things






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






6. Command to print to the screen






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






8. modulo






9. exponent AND assignment operator






10. floor division AND assignment operator






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






12. add AND assignment operator






13. absolute value






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






15. Function to read the contents of a file






16. turns an object into an integer






17. turns an object into an integer






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






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






20. Function to open or read a file






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






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






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






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






25. floor division






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






27. Symbol to add things together






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






29. writes stuff to the file






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. Prints a string to the screen which is a signed decimal.






32. square root






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






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






35. Adds something to a variable






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






37. Prevents a runtime error from stopping the program.






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






39. turns an object into a string






40. empties the file






41. A statement that ends the current iteration of a loop but continues looping.






42. Symbol to add things together






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






44. Symbol used to create comments






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






46. Less than or equal to symbol






47. exponentiation






48. The extension for Python scripts






49. exponentiation






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