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. A string that begins with the % symbol and contains a sequence of printable characters and format specifiers that determine how values output should look.






2. empties the file






3. add AND assignment operator






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






5. Adds a new line character






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






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






8. Greater than or equal symbol.






9. Function to read the contents of a file






10. absolute value






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






12. square root






13. subtract AND assignment operator






14. exponentiation






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






16. Greater than symbol






17. Adds something to a variable






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






19. The extension for Python scripts






20. square root






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






22. Function to write something to a file






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






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






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






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






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






28. unction to read one line of a file






29. exponentiation






30. Less than or equal to symbol






31. ,multi-line comment hard-code,Fix (data or parameters) in a program in such a way that they cannot easily be altered by the user.






32. prints its parameter to the console






33. Symbol used to create comments






34. Symbol used to create comments






35. modulus AND assignment operator






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






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






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






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






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






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






42. Prevents a runtime error from stopping the program.






43. Argument variable






44. Adds something to a variable






45. modulo






46. Less than symbol






47. Where the parameters go. A necessary punctuation after any function even if it's empty.






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






49. The extension for Python scripts






50. floor division AND assignment operator