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. A built-in function that converts its argument to a string.






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






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






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






5. empties the file






6. divide AND assignment operator






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






8. The extension for Python scripts






9. A string that begins with the % symbol and contains a sequence of printable characters and format specifiers that determine how values output should look.






10. This statement causes an exception.






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






12. A statement that breaks out of a loop.






13. Greater than symbol






14. The extension for Python scripts






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






16. Writes stuff to the file.






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






18. prints its parameter to the console






19. A boolean operator that takes two strings and returns True if the first appears as a substring in the second.






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






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






22. Symbol to add things together






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






24. Create a variable.






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






26. Command to print to the screen






27. Reads just one line of a text file.






28. floor division






29. assignment operator






30. Function to write something to a file






31. Greater than symbol






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






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






34. multiply AND assignment operator






35. add AND assignment operator






36. deletes an item from a list






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






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






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






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






41. Adds a new line character






42. Less than symbol






43. assignment operator






44. Prevents a runtime error from stopping the program.






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






46. End header line.






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






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






49. Greater than or equal symbol.






50. Adds a new line character