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






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






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






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






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






6. Symbol to multiply things






7. assignment operator






8. modulus AND assignment operator






9. Symbol to add things together






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






11. Less than symbol






12. This keyword attempts to do something that would cause the program to crash if it were not for this statement.






13. adds an item to a list






14. Symbol to add things together






15. square root






16. deletes an item from a list






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






18. multiply AND assignment operator






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






20. The extension for Python scripts






21. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. x is not y - here is not results in 1 if id(x) is not equal to id(y).






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






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






24. Adds something to a variable






25. turns an object into an integer






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






27. exponentiation






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






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






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






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






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






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






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






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






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






37. deletes an item from a list






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






39. Greater than or equal symbol.






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






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






42. add AND assignment operator






43. Command to print to the screen






44. turns an object into an integer






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






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






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






48. Less than or equal to symbol






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






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