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. Binary Ones Complement Operator is unary and has the efect of 'flipping' bits. (~a ) will give -60 which is 1100 0011






2. floor division






3. Adds something to a variable






4. Symbol to add things together






5. writes stuff to the file






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






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






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






9. Function to write something to a file






10. single line comment






11. Symbol to subtract things from each other






12. This statement causes an exception.






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






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






15. sets the file's current position






16. deletes an item from a list






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






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






19. Greater than symbol






20. Greater than or equal symbol.






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






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






23. exponentiation






24. modulus AND assignment operator






25. Function to open or read a file






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






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






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






29. multiply AND assignment operator






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






31. adds an item to a list






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






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






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






35. End header line.






36. deletes an item from a list






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






38. The extension for Python scripts






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






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






41. End header line.






42. add AND assignment operator






43. modulo






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






45. unction to read one line of a file






46. Greater than or equal symbol.






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






48. subtract AND assignment operator






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






50. Symbol used to create comments