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. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.






2. empties the file






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






4. turns an object into an integer






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






6. Greater than symbol






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






8. Symbol to multiply things






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






10. Reads just one line of a text file.






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






12. divide AND assignment operator






13. floor division AND assignment operator






14. modulo






15. modulus AND assignment operator






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






17. floor division






18. floor division AND assignment operator






19. An operator to check whether two variables refer to the same object.






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






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






22. Symbol to add things together






23. absolute value






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






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






26. deletes an item from a list






27. turns an object into a string






28. Prevents a runtime error from stopping the program.






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






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






31. absolute value






32. deletes an item from a list






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






34. multiply AND assignment operator






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






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






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






38. Less than or equal to symbol






39. floor division






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. sets the file's current position






42. A built-in function that converts its argument to a string.






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






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






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






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






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






48. The extension for Python scripts






49. Argument variable






50. turns an object into an integer