Test your basic knowledge |

Basic Python Programming

Subject : it-skills
  • 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 statement that assigns a value to a variable.

2. absolute value

3. Function to write something to a file

4. Less than symbol

5. exponentiation

6. This statement causes an exception.

7. Function to read the contents of a file

8. subtract AND assignment operator

9. Create a variable.

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

11. deletes an item from a list

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

13. Less than or equal to symbol

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

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. Prints a string to the screen which is a signed decimal.

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

18. turns an object into a string

19. Greater than or equal symbol.

20. Symbol to subtract things from each other

21. A built-in function that converts its argument to a string.

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

23. Command to print to the screen

24. Argument variable

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

26. prints its parameter to the console

27. square root

28. add AND assignment operator

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

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

31. Function to open or read a file

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

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

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

35. Symbol to multiply things

36. exponent AND assignment operator

37. Less than symbol

38. A statement that breaks out of a loop.

39. Symbol to multiply things

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

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

42. floor division AND assignment operator

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

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

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

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

47. Symbol used to create comments

48. Adds a new line character

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

50. Symbol to add things together