IT 117: Intermediate Scripting
Quiz 9 Answers
-
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
-
What is the name of the method that will return a string
representation of an object?
__str__
-
What is the name of the method that allows you
to add two objects together?
__add__
-
What is the name of the method that allows you
to subtract one object from another?
__sub__
-
What is the name of the boolean method that allows you
to test whether one object is equal to another?
__eq__
-
What is the name of the boolean method that allows you
to test whether one object is greater than another?
__gt__
-
What do you call the feature of Python that allows you
to construct a new class based on another class?
inheritance
-
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
-
If one class is used to create another class, what do
you call the new class?
a subclass
-
If one class is used to create another class, what do
you call the original class?
a superclass