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 logical operator which returns a value of True if either of the conditions is true.






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






3. Reads just one line of a text file.






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






5. empties the file






6. Symbol to multiply things






7. A statement that displays a value on the screen.






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






9. Modulus operator. It's the remainder after division






10. Writes stuff to the file.






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






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






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






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






15. unction to read one line of a file






16. floor division AND assignment operator






17. prints its parameter to the console






18. Less than symbol






19. divide AND assignment operator






20. The extension for Python scripts






21. modulo






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






23. unction to read one line of a file






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






25. deletes an item from a list






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






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






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






29. Create a variable.






30. End header line.






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






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






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






34. Less than symbol






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






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






37. modulo






38. This statement causes an exception.






39. assignment operator






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






41. Create a variable.






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






43. Function to open or read a file






44. Greater than or equal symbol.






45. exponent AND assignment operator






46. modulus AND assignment operator






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






48. multiply AND assignment operator






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






50. turns an object into a string