1. Inheritance is the process by which a "child" class derives the data and behavior of a "parent" class
2. Another way of thinking of inheritance is a way of arranging objects in a hierarchy from the most _________________________
3. An object which inherits from another object is considered to be a _____type of that object
4. We also often say that a class is a subclass or child class of a class from which it inherits, or that the other class is its superclass or ________________
5. We can refer to the most generic class in the hierarchy as a ________________
6. Inheritance is also a way of ______________
7. Analyse the following code. Name the base class and the sub class.
def __init__(self, name, surname, number):
self.name = name
self.surname = surname
self.number = number
UNDERGRADUATE, POSTGRADUATE = range(2)
def __init__(self, student_type, *args, **kwargs):
self.student_type = student_type
self.classes = 
super(Student, self).__init__(*args, **kwargs)
def enrol(self, course):
PERMANENT, TEMPORARY = range(2)
def __init__(self, employment_type, *args, **kwargs):
self.employment_type = employment_type
super(StaffMember, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
self.courses_taught = 
super(Lecturer, self).__init__(*args, **kwargs)
def assign_teaching(self, course):
jane = Student(Student.POSTGRADUATE, "Ruth", "Marvin", "SMTJNX045")
bob = Lecturer(StaffMember.PERMANENT, "Jonathan", "Peter", "123456789")
The base class doesn't exist, as this example uses inheritance
The base class is 'Person' and the subclass is 'StaffMember'
The base class is 'StaffMember' and the subclass is 'Person'
There are two base classes - as there is no inheritance in this example
8. The following code demonstrates _____________ inheritance
9. Real world example for ______: If your father played chess, you inherited this ability, but you also like to dance. Your son, if you have one, could inherit both your father's ability to play chess as well as your dance moves!
10. _________inheritance is when a child class derives attributes and methods from more than one parent class
11. What is the output of the following piece of code?
12. Analyse this code that includes inheritance. What is the output?
13. Predict the output here - note the inheritance that is taking place.
14. Predict the output of the following code.
16. The following is an example of:
17. In some languages it is possible to create a class which can’t be instantiated.
18. In Python we can’t prevent anyone from instantiating a class, but we can create something similar to an ____________ by using NotImplementedError inside our method definitions.
19. Look closely here for any evidence of encapsulation. Predict the output of this program.
20. Method issubclass() returns True if a class is a subclass of another class and False otherwise.