16 Questions
What does inheritance create in object-oriented programming?
A 'is a' relationship among classes
What kind of characteristics does a specialized object have in relation to the general object?
All of the characteristics of the general object, plus additional special characteristics
Which term best describes the relationship between a post graduate student and a student?
Specialization
What term describes the relationship between an employee and a person?
'Is a' relationship
Which relationship can be extended through inheritance in object-oriented programming?
'Is a' relationship
What is the purpose of inheritance in object-oriented programming?
To create reusable classes with shared characteristics
What is the term used for the relationship between a superclass and a subclass?
Parent-child relationship
Which keyword is used in Java to define a subclass?
extends
What happens to private members of the superclass in a subclass?
They are not inherited by the subclass
Which keyword refers to an object's superclass in Java?
super
When a subclass is instantiated, which constructor is executed first?
Superclass default constructor
What must be the first Java statement in a subclass constructor when calling a superclass constructor?
super
keyword
What is it called when a subclass method has the same signature as a superclass method?
Method overriding
Which annotation should be used before a subclass method declaration to indicate method overriding?
@Override
In a Salaried Employee class, how can the get_salary() method be modified to override the superclass method?
public double get_salary() { return salary + bonus - deductions ; }
What happens to constructors when a subclass is instantiated?
Superclass default constructor is executed first
Explore the concept of inheritance in object-oriented programming, focusing on the relationship between generalization and specialization. Learn how real-life objects can be specialized versions of more general objects, and understand how this concept applies to post-graduated students, undergraduate students, and their unique characteristics.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free