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. The extension for Python scripts






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






3. This statement causes an exception.






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






5. multiply AND assignment operator






6. Less than or equal to symbol






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






8. End header line.






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






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






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






12. A statement that displays a value on the screen.






13. Greater than or equal symbol.






14. single line comment






15. floor division






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






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






18. Prevents a runtime error from stopping the program.






19. Command to print to the screen






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






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






22. unction to read one line of a file






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






24. Adds something to a variable






25. A logical operator which returns a value of True if either of the conditions is true.






26. Greater than symbol






27. Symbol to multiply things






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






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






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






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






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






33. deletes an item from a list






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






35. divide AND assignment operator






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






37. Function to open or read a file






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






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






40. turns an object into an integer






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






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






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






44. Adds something to a variable






45. Symbol to multiply things






46. Greater than or equal symbol.






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






48. absolute value






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






50. Symbol to add things together