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 keyword that does nothing but fill space to indicate code which will be written later.






2. prints its parameter to the console






3. turns an object into an integer






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






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






6. Adds a new line character






7. Function to open or read a file






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






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






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






11. exponentiation






12. absolute value






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






14. Writes stuff to the file.






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






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






17. subtract AND assignment operator






18. End header line.






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






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






21. Function to write something to a file






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






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






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






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






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






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






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






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






30. inserts an item inside a list at a certain index






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






32. deletes an item from a list






33. modulus AND assignment operator






34. divide AND assignment operator






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






36. modulo






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






38. square root






39. Greater than or equal symbol.






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






41. Function to open or read a file






42. Symbol used to create comments






43. square root






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






45. prints its parameter to the console






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






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






48. Symbol to subtract things from each other






49. Create a variable.






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