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. Prints a string to the screen which will be Unicode.






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






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






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






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






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






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






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






9. turns an object into a string






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






11. modulus AND assignment operator






12. divide AND assignment operator






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






14. Less than symbol






15. This statement causes an exception.






16. Function to open or read a file






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






18. empties the file






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






20. multiply AND assignment operator






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






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






23. Greater than symbol






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






25. turns an object into an integer






26. Function to read the contents of a file






27. exponent AND assignment operator






28. Symbol to add things together






29. turns an object into a string






30. exponent AND assignment operator






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






32. square root






33. Adds something to a variable






34. modulus AND assignment operator






35. assignment operator






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






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






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






39. Symbol to multiply things






40. Greater than symbol






41. adds an item to a list






42. Argument variable






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






44. Symbol to subtract things from each other






45. Symbol used to create comments






46. End header line.






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






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






49. add AND assignment operator






50. A statement that assigns a value to a variable.