Try to answer these 20+ Inheritance MCQs and check your understanding of the Inheritance subject.
Scroll down and let's begin!
A. None
B. Inheritance
C. Encapsulation
D. Polymorphism
When base class is derived in protected mode, then______________.
1. public members of base class become private members of derived class
2. public members of base class become protected members of derived class
3. public members of base class become public members of derived class
4. protected members of base class become protected members of derived class
5. protected members of base class become private members of derived class
6. protected members of base class become public members of derived class
A.
Only 2, 6
B.
Only 1, 5
C.
Only 1, 6
D.
2 , 4
A. :
B. /
C. ::
D. ;
A. No
B. Yes
A. Protected
B. Public
C. Private
D. Struct can’t inherit class
A. Constructor of derived class will be executed first followed by base class
B. Constructor of derived class will be invoked first
C. Constructor of base class will be invoked first
D. Constructor of base class will be executed first followed by derived class
A. False
B. True
A. Private member is not inheritable and not accessible in derived class
B. Both are inheritable but protected is not accessible in the derived class
C. Protected member is inheritable and also accessible in derived class
D. Both are inheritable but private is accessible in the derived class
A. No
B. Yes
A. Multilevel
B. Single
C. Hierarchical
D. Multiple
In case of inheritance where both base and derived class are having constructor and destructor, then which if the following are true?
1. Constructors are executed in their order of derivation
2. Constructors are executed in reverse order of derivation
3. Destructors are executed in their order of derivation
4. Destructors are executed in reverse order of derivation
A.
Only 2, 3
B.
Only 1 , 3
C.
Only 2 ,4
D.
Only 1 , 4
A. None
B. Protected members of the base class become private members of derived class And public members of the base class become private members of derived class
C. Protected members of the base class become private members of derived class
D. Public members of the base class become private members of derived class
A. Public
B. Protected
C. Friend
D. Private
A. Compiler dependent
B. Mandatory
C. Optional
D. Error
A. All
B. Write virtual functions is base class
C. Make base class as virtual base class
D. Write Virtual function in parent classes
A. Inheritance
B. Encapsulation
C. Polymorphism
D. Composition
A. Inheritance
B. Privacy
C. The constructor
D. The destructor
A. Default class
B. Superclass
C. Subclass
A. Is-a
B. True
C. False
D. Class
A. Is-a
B. Has-a
C. Both A & B
D. None of the above
A. Line 4, Line 10
B. Line 1, LIne 4
C. Line 0, Line 4
D. None of these
A. TT
B. Tt
C. Tt
D. Homozygous
E. Tt or heterozygous