#1
Which of the following best defines inheritance in object-oriented programming?
The process of creating a new class from an existing class
ExplanationInheritance involves creating a new class (subclass) based on an existing class (superclass).
#2
In OOP, what does 'superclass' refer to?
A class from which other classes are inherited
ExplanationSuperclass is a class from which other classes inherit properties and behaviors.
#3
Which keyword is used in Java to implement inheritance?
extend
ExplanationThe 'extend' keyword is used in Java to establish inheritance between classes.
#4
What is the term used to describe the ability of a class to have more than one superclass?
Multiple inheritance
ExplanationMultiple inheritance allows a class to inherit properties and behaviors from more than one superclass.
#5
Which of the following is true regarding private members of a superclass in inheritance?
They cannot be accessed by subclasses
ExplanationPrivate members of a superclass are inaccessible to subclasses.
#6
In Java, which keyword is used to prevent a method from being overridden in a subclass?
final
ExplanationThe 'final' keyword in Java prevents a method from being overridden in a subclass.
#7
In OOP, what is the process called when a subclass provides a specific implementation of a method that is already defined in its superclass?
Method overriding
ExplanationMethod overriding occurs when a subclass redefines a method from its superclass with its own implementation.
#8
Inheritance represents which type of relationship between classes?
Is-a
ExplanationInheritance signifies an 'is-a' relationship where a subclass 'is-a' type of its superclass.
#9
What is the significance of the 'final' keyword in Java?
All of the above.
ExplanationThe 'final' keyword in Java can be applied to classes, methods, and variables to indicate various constraints.