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






2. floor division AND assignment operator






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






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






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






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






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






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






9. absolute value






10. Reads the contents of the file you can assign the result to a variable.






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






12. Argument variable






13. End header line.






14. Less than symbol






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






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






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






18. exponent AND assignment operator






19. Greater than symbol






20. A statement that ends the current iteration of a loop but continues looping.






21. Adds something to a variable






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






23. Greater than or equal symbol.






24. multiply AND assignment operator






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






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






27. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. x is not y - here is not results in 1 if id(x) is not equal to id(y).






28. exponentiation






29. Prevents a runtime error from stopping the program.






30. multiply AND assignment operator






31. A logical operator which requires two expressions to both be true.






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






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






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






35. sets the file's current position






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






37. absolute value






38. modulo






39. The extension for Python scripts






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






41. Less than or equal to symbol






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






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






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






45. Reads just one line of a text file.






46. adds an item to a list






47. A statement that breaks out of a loop.






48. single line comment






49. Symbol to add things together






50. Less than or equal to symbol