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






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






3. Empties the file - watch out if you care about the file.






4. Greater than or equal symbol.






5. prints its parameter to the console






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






7. empties the file






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






9. Symbol to subtract things from each other






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






11. Function to read the contents of a file






12. Prevents a runtime error from stopping the program.






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






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






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






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






17. Greater than or equal symbol.






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






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






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






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






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






23. deletes an item from a list






24. Command to print to the screen






25. Greater than symbol






26. Greater than symbol






27. Symbol used to create comments






28. exponentiation






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






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






31. Adds something to a variable






32. The extension for Python scripts






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






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






35. deletes an item from a list






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






37. Create a variable.






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






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






40. modulo






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






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






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






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






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






46. A logical operator which negates an expression so that it returns a value of True if the expression is false.






47. A logical operator which returns a value of True if either of the conditions is true.






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






49. unction to read one line of a file






50. multiply AND assignment operator