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. Function to empty the contents of a file - no recovery is possible






2. Create a variable.






3. exponent AND assignment operator






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






5. assignment operator






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






7. Greater than or equal symbol.






8. empties the file






9. Less than or equal to symbol






10. Symbol used to create comments






11. Function to write something to a file






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






13. Greater than symbol






14. Symbol to add things together






15. absolute value






16. Function to read the contents of a file






17. End header line.






18. Less than symbol






19. Less than or equal to symbol






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






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






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






23. unction to read one line of a file






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






25. adds an item to a list






26. Adds a new line character






27. floor division






28. writes stuff to the file






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






30. End header line.






31. Symbol used to create comments






32. prints its parameter to the console






33. add AND assignment operator






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






35. This statement causes an exception.






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






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






38. Symbol to multiply things






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






40. Symbol to subtract things from each other






41. floor division AND assignment operator






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






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. Command to print to the screen






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






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






47. assignment operator






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






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






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