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






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






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






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






5. Symbol to subtract things from each other






6. subtract AND assignment operator






7. absolute value






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






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






10. assignment operator






11. The extension for Python scripts






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






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






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






15. This statement causes an exception.






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






17. floor division






18. Symbol to multiply things






19. rounds a number to the number of decimal points you choose






20. exponentiation






21. modulus AND assignment operator






22. deletes an item from a list






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






24. deletes an item from a list






25. Adds something to a variable






26. turns an object into an integer






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






28. empties the file






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






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






31. Command to print to the screen






32. Greater than or equal symbol.






33. Argument variable






34. add AND assignment operator






35. square root






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






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






38. End header line.






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






40. Function to open or read a file






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






42. single line comment






43. Greater than symbol






44. End header line.






45. This keyword in the body of a conditional allows chained conditionals.






46. square root






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






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






49. Symbol to subtract things from each other






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