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 XOR Operator copies the bit if it is set in one operand but not both. (a ^ b) will give 49 which is 0011 0001






2. square root






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






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






5. Writes stuff to the file.






6. modulo






7. Prevents a runtime error from stopping the program.






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






9. single line comment






10. exponent AND assignment operator






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






12. turns an object into a string






13. Greater than symbol






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






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






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






17. exponentiation






18. Create a variable.






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






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






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






22. multiply AND assignment operator






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






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






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






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






27. unction to read one line of a file






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






29. modulo






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






31. absolute value






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






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






34. Function to read the contents of a file






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






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






37. floor division






38. Less than symbol






39. Function to open or read a file






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






41. Adds a new line character






42. Command to print to the screen






43. assignment operator






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






45. Function to open or read a file






46. Symbol to subtract things from each other






47. A string that begins with the % symbol and contains a sequence of printable characters and format specifiers that determine how values output should look.






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






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






50. Argument variable