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. Function to empty the contents of a file - no recovery is possible






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






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






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






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






6. empties the file






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






8. prints its parameter to the console






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






10. assignment operator






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






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






13. Symbol to multiply things






14. turns an object into an integer






15. subtract AND assignment operator






16. Function to read the contents of a file






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






18. Function to open or read a file






19. Writes stuff to the file.






20. Less than or equal to symbol






21. Symbol to multiply things






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






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






24. absolute value






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






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






27. prints its parameter to the console






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






29. unction to read one line of a file






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






31. Less than symbol






32. Function to close a file - it will not be able to be used again unless the file is opened.






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






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






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






36. Symbol to subtract things from each other






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






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






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






40. multiply AND assignment operator






41. subtract AND assignment operator






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






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






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






45. Symbol used to create comments






46. multiply AND assignment operator






47. The extension for Python scripts






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






49. exponent AND assignment operator






50. modulus AND assignment operator