Inheritance (OOP) (OCR A-Level Computer Science): Quizzes
📚Quizzes
Practise the questions
12 questions from this quiz
ShowHide
Practise the questions
12 questions from this quiz
What is the main purpose of inheritance in OOP?
What is the main purpose of inheritance in OOP?
To promote code reuse & hierarchy
Which term refers to the class from which attributes and methods are inherited?
Which term refers to the class from which attributes and methods are inherited?
Parent class
What is another name for a child class?
What is another name for a child class?
Subclass
In Python, how is inheritance established?
In Python, how is inheritance established?
By passing parent as parameter
What is method overriding?
What is method overriding?
Child provides new implementation
What is the purpose of the super() function?
What is the purpose of the super() function?
Access parent class methods
Can a child class have its own unique methods in addition to inherited ones?
Can a child class have its own unique methods in addition to inherited ones?
Yes, can add unique methods
Which benefit of inheritance reduces code redundancy?
Which benefit of inheritance reduces code redundancy?
Code reusability
What is a common mistake when overriding methods?
What is a common mistake when overriding methods?
Forgetting to call super()
What does inheritance enable regarding class hierarchy?
What does inheritance enable regarding class hierarchy?
Extension of general to specific
When is composition preferred over inheritance?
When is composition preferred over inheritance?
When there's no strong 'is-a' link
What does extendability in inheritance allow?
What does extendability in inheritance allow?
Child classes to add/override
