Recall & Review
beginner
What does it mean to inherit attributes and methods in Python?
It means a new class (child) can use the properties (attributes) and actions (methods) of an existing class (parent) without rewriting them.
Click to reveal answer
beginner
How do you define a child class that inherits from a parent class in Python?You write the child class name followed by parentheses containing the parent class name, like: <code>class Child(Parent):</code>Click to reveal answer
beginner
If a child class does not have a method, but the parent class does, what happens when you call that method on a child object?The child object uses the parent's method automatically because it inherits it.
Click to reveal answer
intermediate
What is the purpose of the
super() function in inheritance?<code>super()</code> lets the child class call a method from its parent class, often to extend or reuse the parent's behavior.Click to reveal answer
beginner
Can a child class have its own attributes and methods different from the parent class?Yes, a child class can add new attributes and methods or override existing ones from the parent.Click to reveal answer
How do you indicate that a class
Dog inherits from a class Animal in Python?✗ Incorrect
In Python, inheritance is shown by putting the parent class name in parentheses after the child class name.
If a parent class has a method
walk() and the child class does not, what happens when you call walk() on a child object?✗ Incorrect
The child inherits methods from the parent, so it uses the parent's
walk() method.What does the
super() function do in a child class?✗ Incorrect
super() is used to call a method from the parent class inside the child class.Can a child class have attributes that the parent class does not have?
✗ Incorrect
Child classes can add new attributes and methods beyond what the parent has.
Which of these is true about method overriding in inheritance?
✗ Incorrect
Method overriding means the child class defines a method with the same name to replace the parent's version.
Explain in your own words what happens when a child class inherits from a parent class in Python.
Think about how a child can reuse and extend what the parent has.
You got /3 concepts.
Describe how and why you would use the
super() function inside a child class method.Imagine you want to add something extra but keep the parent's work.
You got /3 concepts.