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. Holds the value of something - e.g. oh_hi = 4 where oh_hi is the variable.






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






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






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






5. Create a variable.






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






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






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






9. modulo






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






11. Prevents a runtime error from stopping the program.






12. Symbol used to create comments






13. Binary OR Operator copies a bit if it exists in eather operand. (a | b) will give 61 which is 0011 1101






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






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






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






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






18. exponentiation






19. Greater than symbol






20. modulus AND assignment operator






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






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






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






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






25. Function to read the contents of a file






26. Less than or equal to symbol






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






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






29. Less than or equal to symbol






30. End header line.






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






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






33. floor division






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






35. Function to write something to a file






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






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






38. turns an object into a string






39. exponentiation






40. sets the file's current position






41. assignment operator






42. writes stuff to the file






43. divide AND assignment operator






44. floor division






45. modulus AND assignment operator






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






47. Symbol to multiply things






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






49. Command to print to the screen






50. End header line.