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. Symbol used to create comments






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






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






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






5. Argument variable






6. absolute value






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






8. add AND assignment operator






9. divide AND assignment operator






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






11. multiply AND assignment operator






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






13. prints its parameter to the console






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






15. Less than symbol






16. modulo






17. Function to write something to a file






18. subtract AND assignment operator






19. modulus AND assignment operator






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






21. sets the file's current position






22. Symbol to subtract things from each other






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






24. Adds a new line character






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






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






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






28. single line comment






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






30. modulo






31. multiply AND assignment operator






32. Function to read the contents of a file






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






34. The extension for Python scripts






35. deletes an item from a list






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






37. ,multi-line comment hard-code,Fix (data or parameters) in a program in such a way that they cannot easily be altered by the user.






38. Function to write something to a file






39. empties the file






40. This statement causes an exception.






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






42. Less than or equal to symbol






43. assignment operator






44. Symbol to multiply things






45. modulus AND assignment operator






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






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






48. Evaluates to true if it finds a variable in the specified sequence and false otherwise. x in y - here in results in a 1 if x is a member of sequence y.






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






50. Prevents a runtime error from stopping the program.