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. Less than symbol






2. Command to print to the screen






3. Function to open or read a file






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






5. A built-in function that converts its argument to a string.






6. Symbol used to create comments






7. Function to read the contents of a file






8. Adds something to a variable






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






10. Less than or equal to symbol






11. A keyword that does nothing but fill space to indicate code which will be written later.






12. sets the file's current position






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






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






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






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






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






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






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






20. single line comment






21. Symbol to add things together






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






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






24. square root






25. add AND assignment operator






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






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






28. floor division






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






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






31. Writes stuff to the file.






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






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






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






35. turns an object into a string






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






37. prints its parameter to the console






38. Symbol to multiply things






39. This statement causes an exception.






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






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






42. turns an object into a string






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






44. Greater than symbol






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






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






47. Reads just one line of a text file.






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






49. Symbol to subtract things from each other






50. Symbol to multiply things