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. assignment operator






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






3. Command to print to the screen






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






5. Function to empty the contents of a file - no recovery is possible






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






7. Greater than or equal symbol.






8. A statement that breaks out of a loop.






9. Adds a new line character






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






11. Prevents a runtime error from stopping the program.






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






13. prints its parameter to the console






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






15. This statement causes an exception.






16. Greater than or equal symbol.






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






18. Symbol to add things together






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






20. exponent AND assignment operator






21. square root






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






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. A built-in function that converts integers and strings to floating-point numbers.






25. divide AND assignment operator






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






27. multiply AND assignment operator






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






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






30. exponentiation






31. Less than or equal to symbol






32. writes stuff to the file






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






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






35. adds an item to a list






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






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






38. Less than or equal to symbol






39. sets the file's current position






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






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






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






43. square root






44. absolute value






45. Argument variable






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






47. deletes an item from a list






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






49. Less than symbol






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