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






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






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






4. prints its parameter to the console






5. Less than symbol






6. single line comment






7. Adds a new line character






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






9. Writes stuff to the file.






10. unction to read one line of a file






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






12. turns an object into a string






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






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






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






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






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






18. floor division






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






20. subtract AND assignment operator






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






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






23. Command to print to the screen






24. exponent AND assignment operator






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






26. square root






27. Greater than symbol






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






29. The extension for Python scripts






30. Function to write something to a file






31. Symbol to subtract things from each other






32. absolute value






33. floor division






34. Adds a new line character






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






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






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






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






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






40. Prevents a runtime error from stopping the program.






41. deletes an item from a list






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






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






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






45. Function to read the contents of a file






46. Greater than or equal symbol.






47. assignment operator






48. modulus AND assignment operator






49. exponent AND assignment operator






50. deletes an item from a list