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. unction to read one line of a file






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






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






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






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






7. Less than or equal to symbol






8. Less than symbol






9. Argument variable






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






11. subtract AND assignment operator






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






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






14. empties the file






15. Function to write something to a file






16. divide AND assignment operator






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






18. Function to open or read a file






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






20. This statement causes an exception.






21. Command to print to the screen






22. turns an object into an integer






23. sets the file's current position






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






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






26. Modulus operator. It's the remainder after division






27. A logical operator which returns a value of True if either of the conditions is true.






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






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






30. square root






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






32. modulus AND assignment operator






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






34. floor division






35. Prevents a runtime error from stopping the program.






36. Function to read the contents of a file






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






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






39. Greater than or equal symbol.






40. Symbol to subtract things from each other






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






42. modulo






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






44. adds an item to a list






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






46. writes stuff to the file






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






48. A data type for representing numbers with fractional values.






49. Symbol to multiply things






50. End header line.