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 keyword attempts to do something that would cause the program to crash if it were not for this statement.






2. Symbol to add things together






3. turns an object into a string






4. Create a variable.






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






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






7. Symbol used to create comments






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






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






10. Function to read the contents of a file






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






12. turns an object into a string






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






14. divide AND assignment operator






15. An operator that removes a value from a list.






16. Function to open or read a file






17. floor division AND assignment operator






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






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






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






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






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






23. add AND assignment operator






24. The extension for Python scripts






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






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






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






28. Reads just one line of a text file.






29. exponent AND assignment operator






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






31. turns an object into an integer






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






33. absolute value






34. Adds something to a variable






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






36. Greater than symbol






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






38. Symbol to subtract things from each other






39. Less than or equal to symbol






40. subtract AND assignment operator






41. Less than symbol






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






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






44. modulus AND assignment operator






45. multiply AND assignment operator






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






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






48. adds an item to a list






49. Adds a new line character






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