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






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






3. empties the file






4. unction to read one line of a file






5. turns an object into a string






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






7. Argument variable






8. Greater than symbol






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






10. add AND assignment operator






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






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






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






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






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






16. deletes an item from a list






17. absolute value






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






19. Command to print to the screen






20. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101






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






22. Symbol to multiply things






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






24. Called Logical AND operator. If both the operands are true then then condition becomes true. (a and b) is true.






25. prints its parameter to the console






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






27. deletes an item from a list






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






29. End header line.






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






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






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






33. Prevents a runtime error from stopping the program.






34. Command to print to the screen






35. square root






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






37. Less than or equal to symbol






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






39. Symbol used to create comments






40. Function to write something to a file






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






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






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






44. Adds a new line character






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






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






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






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






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