PRACTICE • LEARN • GROW
Module 4 Final Quiz: Inheritance MCQs
Solve topic-wise placement questions and improve your skills.
Module 4 Final Quiz: Inheritance Progress
0 of 11 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
What relationship does Inheritance model between a child class and its parent class?
A.
HAS-A relationship
B.
IS-A relationship
C.
USES-A relationship
D.
PRODUCES-A relationship
Explanation & Key
Correct Answer:
2
What is the Diamond Problem in object-oriented inheritance?
A.
When an object consumes 4 times more heap space than expected
B.
Ambiguity that arises in multiple inheritance when a class inherits from two parent classes that both derive from a single common ancestor
C.
When four constructors call each other in an infinite cycle
D.
When a database deadlock occurs
Explanation & Key
Correct Answer:
3
How does Java solve the Diamond Problem while still providing flexible polymorphism?
A.
By allowing multiple class inheritance with special compiler flags
B.
By prohibiting multiple class inheritance, allowing a class to extend only one parent while implementing multiple interfaces
C.
By converting all classes to structs
D.
By using virtual base classes only in runtime
Explanation & Key
Correct Answer:
4
Which inheritance type involves a chain where Class B inherits from Class A, and Class C inherits from Class B?
A.
Hierarchical Inheritance
B.
Multilevel Inheritance
C.
Multiple Inheritance
D.
Circular Inheritance
Explanation & Key
Correct Answer:
5
What is the purpose of the 'super' keyword when used in a subclass constructor?
A.
To invoke the constructor of the immediate superclass
B.
To allocate memory for the supercomputer
C.
To destroy the parent class
D.
To make the constructor public
Explanation & Key
Correct Answer:
6
Can private members of a superclass be accessed directly by methods in a derived subclass?
A.
Yes, always
B.
No, private members remain inaccessible directly to subclasses; they can only be reached via inherited public or protected methods
C.
Yes, if the subclass is public
D.
Only in C++, never in Java
Explanation & Key
Correct Answer:
7
Which type of inheritance occurs when two separate classes (e.g. Car and Truck) both inherit from a single Vehicle class?
A.
Multiple Inheritance
B.
Hierarchical Inheritance
C.
Single Inheritance
D.
Hybrid Inheritance
Explanation & Key
Correct Answer:
8
What keyword is used in Java to inherit from a parent class?
A.
implements
B.
extends
C.
inherits
D.
derives
Explanation & Key
Correct Answer:
9
In C++, how is the diamond problem avoided when inheriting multiple base classes?
A.
Using the 'final' keyword
B.
Using Virtual Inheritance (e.g. 'class B : virtual public A')
C.
Using abstract constructors
D.
C++ automatically eliminates duplicated ancestor subobjects
Explanation & Key
Correct Answer:
10
What is Hybrid Inheritance?
A.
Inheritance between different programming languages
B.
A design combining two or more distinct inheritance forms (e.g. hierarchical and multiple) in one system
C.
Inheriting without using classes
D.
Inheritance between static and non-static methods
Explanation & Key
Correct Answer:
11
What happens if a child class defines a method with the same name, return type, and parameters as a parent method?
A.
Method Overloading
B.
Method Overriding
C.
Operator Inversion
D.
Syntax Error
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong