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. Prints a string to the screen which is converted using repr()






2. Less than or equal to symbol






3. The extension for Python scripts






4. Symbol to multiply things






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






6. prints its parameter to the console






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






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






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






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






11. Less than or equal to symbol






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






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






14. modulus AND assignment operator






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






16. Function to read the contents of a file






17. assignment operator






18. Symbol to subtract things from each other






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






20. Greater than symbol






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






22. Greater than symbol






23. multiply AND assignment operator






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






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






26. Create a variable.






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






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






29. Less than symbol






30. Function to write something to a file






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






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






33. absolute value






34. Command to print to the screen






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






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






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






38. Create a variable.






39. add AND assignment operator






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






41. absolute value






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






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






44. deletes an item from a list






45. divide AND assignment operator






46. Adds a new line character






47. This statement causes an exception.






48. square root






49. writes stuff to the file






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