Skip to main content

Inheritance

1).What is inheritance in C++?

1) A process of acquiring properties from another class
2) A process of creating new objects
3) A function of encapsulation
4) None of the above

2).Which type of inheritance is not supported in C++?

1) Multiple
2) Multilevel
3) Single
4) Cyclic

3).Which keyword is used to define inheritance in C++?

1) extends
2) inherits
3) derived
4) None of the above

4).What is the base class in inheritance?

1) The class from which properties are inherited
2) The class that inherits properties
3) A function inside a class
4) None of the above

5).What access specifier is used to prevent inheritance?

1) private
2) protected
3) public
4) final

6).What is a virtual base class?

1) A base class designed to avoid multiple inheritance conflicts
2) A base class for dynamic polymorphism
3) A base class that cannot have objects
4) None of the above

7).What is the correct syntax for inheritance?

1) class Derived : public Base {}
2) class Derived inherits Base {}
3) class Derived :: Base {}
4) None of the above

8).What is function overriding?

1) A derived class redefining a base class function
2) A function calling another function
3) A function with multiple definitions
4) None of the above

9).Which of the following is an advantage of inheritance?

1) Code reuse
2) Improved encapsulation
3) Better performance
4) None of the above

10).What is the use of the 'super' keyword in inheritance?

1) To access base class members
2) To call the base class constructor
3) Both A and B
4) None of the above