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






2. subtract AND assignment operator






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






4. Command to print to the screen






5. The extension for Python scripts






6. A built-in function that takes any value and converts it to an integer if possible - or complains otherwise.






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






8. Function to write something to a file






9. divide AND assignment operator






10. Argument variable






11. absolute value






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






13. Argument variable






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






15. empties the file






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






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






18. Create a variable.






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






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






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






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






23. turns an object into an integer






24. Adds something to a variable






25. multiply AND assignment operator






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






27. adds an item to a list






28. absolute value






29. Function to open or read a file






30. Function to write something to a file






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






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






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






34. add AND assignment operator






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






36. deletes an item from a list






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






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






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






40. A statement that assigns a value to a variable.






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






42. prints its parameter to the console






43. deletes an item from a list






44. Greater than or equal symbol.






45. prints its parameter to the console






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






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






48. Less than or equal to symbol






49. Function to open or read a file






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