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 just one line of a text file & keeps track of where in the file you're at






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






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






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






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






6. deletes an item from a list






7. Symbol to multiply things






8. square root






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






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






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






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






13. writes stuff to the file






14. Greater than symbol






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






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






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






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






19. Adds a new line character






20. unction to read one line of a file






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






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






23. Adds something to a variable






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






25. Reads just one line of a text file.






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






27. adds an item to a list






28. exponentiation






29. Greater than or equal symbol.






30. Argument variable






31. sets the file's current position






32. Less than symbol






33. Writes stuff to the file.






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






35. square root






36. modulo






37. subtract AND assignment operator






38. Symbol to add things together






39. A statement that breaks out of a loop.






40. turns an object into an integer






41. Adds something to a variable






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






43. This statement causes an exception.






44. exponent AND assignment operator






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






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






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






48. This variable holds the arguments you pass to your Python script when you run it. Then you unpack it in your script so you have variables you can work with.






49. adds an item to a list






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