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. This keyword in the body of a conditional allows chained conditionals.






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






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






4. turns an object into an integer






5. subtract AND assignment operator






6. Function to open or read a file






7. Prevents a runtime error from stopping the program.






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






9. Symbol to add things together






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






11. empties the file






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






13. turns an object into an integer






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






15. End header line.






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






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






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






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






20. A logical operator which compares two operands and produces True if they are equal and False otherwise






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






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






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






24. assignment operator






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






26. multiply AND assignment operator






27. Symbol used to create comments






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






29. deletes an item from a list






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






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






32. multiply AND assignment operator






33. Adds something to a variable






34. Create a variable.






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






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






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






38. A statement that breaks out of a loop.






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






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






41. absolute value






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






43. Reads just one line of a text file.






44. prints its parameter to the console






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






46. modulus AND assignment operator






47. exponentiation






48. A built-in function that converts integers and strings to floating-point numbers.






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






50. sets the file's current position