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. Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y - here not in results in a 1 if x is a member of sequence y.






2. turns an object into an integer






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






4. absolute value






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






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






10. turns an object into a string






11. floor division






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






13. Symbol used to create comments






14. deletes an item from a list






15. square root






16. Less than symbol






17. A string that begins with the % symbol and contains a sequence of printable characters and format specifiers that determine how values output should look.






18. Greater than symbol






19. Function to open or read a file






20. square root






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






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






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






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






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






26. unction to read one line of a file






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






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






29. modulus AND assignment operator






30. add AND assignment operator






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






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






33. Symbol to add things together






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






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






36. adds an item to a list






37. turns an object into a string






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






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






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






41. writes stuff to the file






42. Argument variable






43. The extension for Python scripts






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






45. Symbol to add things together






46. assignment operator






47. Command to print to the screen






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






49. Create a variable.






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