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






2. turns an object into a string






3. Function to write something to a file






4. Adds a new line character






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






6. Function to open or read a file






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






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






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






10. square root






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






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






13. Adds something to a variable






14. Writes stuff to the file.






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






16. Symbol to subtract things from each other






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






18. This statement causes an exception.






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






20. sets the file's current position






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






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






23. The extension for Python scripts






24. Adds a new line character






25. An operator that removes a value from a list.






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






27. adds an item to a list






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






29. turns an object into an integer






30. turns an object into a string






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






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






33. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011






34. Reads just one line of a text file.






35. empties the file






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






37. Less than or equal to symbol






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






39. turns an object into an integer






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






41. Symbol used to create comments






42. An operator to check whether two variables refer to the same object.






43. square root






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






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






46. subtract AND assignment operator






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






48. exponent AND assignment operator






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






50. writes stuff to the file