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






2. Prevents a runtime error from stopping the program.






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






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






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






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






7. turns an object into an integer






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






9. writes stuff to the file






10. Less than or equal to symbol






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






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






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






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






15. floor division AND assignment operator






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






17. Function to read the contents of a file






18. single line comment






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






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






21. square root






22. Greater than symbol






23. Adds something to a variable






24. Command to print to the screen






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






26. exponent AND assignment operator






27. exponentiation






28. adds an item to a list






29. Adds a new line character






30. modulo






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






32. sets the file's current position






33. unction to read one line of a file






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






35. Command to print to the screen






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






37. modulus AND assignment operator






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






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






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






41. Function to open or read a file






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






43. Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. a << 2 will give 240 which is 1111 0000






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






45. Symbol to multiply things






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






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






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






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






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