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. single line comment






3. The extension for Python scripts






4. Symbol to multiply things






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






6. floor division AND assignment operator






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






8. Prevents a runtime error from stopping the program.






9. Function to open or read a file






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






11. exponent AND assignment operator






12. adds an item to a list






13. adds an item to a list






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






15. Greater than or equal symbol.






16. This statement causes an exception.






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






18. turns an object into a string






19. assignment operator






20. modulus AND assignment operator






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






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






23. Greater than symbol






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






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






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






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






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






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






30. Reads just one line of a text file.






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






32. ,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.






33. Symbol to add things together






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






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






36. End header line.






37. deletes an item from a list






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






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






40. A built-in function that converts integers and strings to floating-point numbers.






41. turns an object into an integer






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






43. writes stuff to the file






44. modulo






45. deletes an item from a list






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






47. square root






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






49. Symbol to add things together






50. add AND assignment operator