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. Reads the contents of the file you can assign the result to a variable.






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






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






4. Function to write something to a file






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






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






7. The extension for Python scripts






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






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






10. Less than symbol






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






12. prints its parameter to the console






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






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






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






16. writes stuff to the file






17. modulo






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






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






20. rounds a number to the number of decimal points you choose






21. This statement causes an exception.






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






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






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






25. divide AND assignment operator






26. Called Logical AND operator. If both the operands are true then then condition becomes true. (a and b) is true.






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






28. multiply AND assignment operator






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






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






31. floor division AND assignment operator






32. Create a variable.






33. square root






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






35. turns an object into an integer






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






37. modulo






38. Less than or equal to symbol






39. Symbol used to create comments






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






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






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






43. Symbol to divide by the number to the right of the symbol






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






45. Symbol to add things together






46. Function to read the contents of a file






47. exponentiation






48. Command to print to the screen






49. Adds a new line character






50. Greater than or equal symbol.