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. Less than symbol






2. This keyword attempts to do something that would cause the program to crash if it were not for this statement.






3. empties the file






4. The extension for Python scripts






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






6. Adds something to a variable






7. Function to write something to a file






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






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






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






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






12. A data type for representing numbers with fractional values.






13. absolute value






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






15. This keyword creates a new class object which is a user-defined type - like a factory for creating objects.






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






17. Greater than or equal symbol.






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






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






20. turns an object into a string






21. floor division






22. sets the file's current position






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






24. Writes stuff to the file.






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






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






27. multiply AND assignment operator






28. square root






29. modulo






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






31. Adds a new line character






32. divide AND assignment operator






33. exponent AND assignment operator






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






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






36. floor division AND assignment operator






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






38. This statement causes an exception.






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






40. Command to print to the screen






41. Reads just one line of a text file.






42. deletes an item from a list






43. turns an object into a string






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






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






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






47. turns an object into an integer






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






49. End header line.






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