IT 117: Intermediate Scripting
Quiz 9 Answers

  1. What do you call the special class of methods that do things like provide a string representation of an object and convert one data type into another?
    magic methods
  2. What is the name of the method that will return a string representation of an object?
    __str__
  3. What is the name of the method that allows you to add two objects together?
    __add__
  4. What is the name of the method that allows you to subtract one object from another?
    __sub__
  5. What is the name of the boolean method that allows you to test whether one object is equal to another?
    __eq__
  6. What is the name of the boolean method that allows you to test whether one object is greater than another?
    __gt__
  7. What do you call the feature of Python that allows you to construct a new class based on another class?
    inheritance
  8. If you want to use a class representing one thing as the basis for a class representing another thing, what must the relationship between the two things be?
    an is a relationship
  9. If one class is used to create another class, what do you call the new class?
    a subclass
  10. If one class is used to create another class, what do you call the original class?
    a superclass