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. turns an object into an integer






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






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






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






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






6. modulo






7. Evaluates to true if it finds a variable in the specified sequence and false otherwise. x in y - here in results in a 1 if x is a member of sequence y.






8. prints its parameter to the console






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






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






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






12. writes stuff to the file






13. Prevents a runtime error from stopping the program.






14. multiply AND assignment operator






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






16. floor division AND assignment operator






17. This statement causes an exception.






18. add AND assignment operator






19. Symbol to subtract things from each other






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






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






22. sets the file's current position






23. exponentiation






24. End header line.






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






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






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






28. exponent AND assignment operator






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






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






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






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






33. Greater than or equal symbol.






34. Command to print to the screen






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






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






37. Adds a new line character






38. Argument variable






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






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






41. modulo






42. The extension for Python scripts






43. Symbol to add things together






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






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






46. absolute value






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






48. deletes an item from a list






49. Function to read the contents of a file






50. subtract AND assignment operator