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. This keyword in the body of a conditional - gives an alternative execution.






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






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






4. Argument variable






5. Adds something to a variable






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






7. Function to read the contents of a file






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






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






10. Symbol used to create comments






11. square root






12. An operator that removes a value from a list.






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






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






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






16. single line comment






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






18. Symbol to add things together






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






20. modulus AND assignment operator






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






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






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






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






25. divide AND assignment operator






26. absolute value






27. Symbol to multiply things






28. This keyword begins a header for a body that repeats until the condition is no longer true.






29. The extension for Python scripts






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






31. modulo






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






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






34. modulus AND assignment operator






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






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






37. Argument variable






38. empties the file






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. rounds a number to the number of decimal points you choose






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






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






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






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






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






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






47. A statement that breaks out of a loop.






48. unction to read one line of a file






49. End header line.






50. Reads just one line of a text file.