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






2. exponentiation






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






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






5. Greater than symbol






6. Function to write something to a file






7. Symbol to multiply things






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






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






10. turns an object into a string






11. End header line.






12. Command to print to the screen






13. absolute value






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






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






16. floor division AND assignment operator






17. single line comment






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






19. absolute value






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






21. Command to print to the screen






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






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






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






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






26. modulo






27. prints its parameter to the console






28. turns an object into a string






29. turns an object into an integer






30. The extension for Python scripts






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






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






33. modulo






34. floor division






35. Function to read the contents of a file






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






37. prints its parameter to the console






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






39. Symbol used to create comments






40. exponent AND assignment operator






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






42. subtract AND assignment operator






43. square root






44. add AND assignment operator






45. Greater than or equal symbol.






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






47. Writes stuff to the file.






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






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






50. empties the file