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. floor division






2. A statement that assigns a value to a variable.






3. floor division






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






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






6. assignment operator






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






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






9. Function to write something to a file






10. Greater than symbol






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






12. Command to print to the screen






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






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






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






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






17. Greater than or equal symbol.






18. add AND assignment operator






19. divide AND assignment operator






20. End header line.






21. unction to read one line of a file






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






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






24. Adds a new line character






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






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






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






28. Argument variable






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






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






31. adds an item to a list






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






33. Symbol used to create comments






34. floor division AND assignment operator






35. Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y - here not in results in a 1 if x is a member of sequence y.






36. ,multi-line comment hard-code,Fix (data or parameters) in a program in such a way that they cannot easily be altered by the user.






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






38. square root






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






40. Symbol to multiply things






41. turns an object into an integer






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






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






44. Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. a << 2 will give 240 which is 1111 0000






45. sets the file's current position






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






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






48. Function to open or read a file






49. writes stuff to the file






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