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. Where the parameters go. A necessary punctuation after any function even if it's empty.

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

3. prints its parameter to the console

4. writes stuff to the file

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

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

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

8. Argument variable

9. Create a variable.

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

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

12. adds an item to a list

13. modulo

14. Function to read the contents of a file

15. Less than or equal to symbol

16. modulo

17. floor division

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. Less than symbol

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

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

22. Less than symbol

23. Adds something to a variable

24. subtract AND assignment operator

25. divide AND assignment operator

26. unction to read one line of a file

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

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

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

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

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

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

33. turns an object into an integer

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

35. A keyword that does nothing but fill space to indicate code which will be written later.

36. End header line.

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

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

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

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

41. Prevents a runtime error from stopping the program.

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

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

44. turns an object into a string

45. A statement that breaks out of a loop.

46. subtract AND assignment operator

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

48. Symbol used to create comments

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

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