C++ Programming - C++ Inheritance Multiple Choice Questions and Answers

Related Topics:

C++ Programming : C++ Inheritance

Inheritance is the process by which one class can inherit the features of another class.Following questions cover all the questions related to C++ Inheritance.
1. Which of the following is false with respect to inheritance?
[A] When a base class is privately inherited,public members of the base class become private members of the derived class
[B] When a base class is publicly inherited,public members of the base class becomes public members of derived class
[C] When a base class is privately inherited,a private member of base class becomes private member of derived class
[D] When a base class is publicly inherited protected members of base class becomes protected members of derived class

Answer: C. When a base class is privately inherited,a private member of base class becomes private member of derived class

2. Which of the following is/are false
[A] Inheritance is deriving new class from existing class
[B] In an inheritance, all data and function members of base class are derived by derived class
[C] We can specify which data and function members of base class will be inherited by derived class
[D] We can add new functions to derived class without recompiling the base class

Answer: B. In an inheritance, all data and function members of base class are derived by derived class

3. A base class will offer
[A] offer more specific objects than its derived classes
[B] correspond to something in the rest world
[C] behave badly when the chops are down
[D] be a generalized version of its derived classes

Answer: D. be a generalized version of its derived classes

4. If a base class member access is public, and an inherited class accesses specifier is private, which of the following statement is true ?
[A] The base class member can be accessed by derived class objects
[B] The base class members cannot be accessed by the derived class members
[C] The derived class members can be accessed by the base class objects
[D] None of above

Answer: A. The base class member can be accessed by derived class objects

5. Choose most appropriate statement
[A] An abstract base class can have pure virtual destructor
[B] An abstract base class can have only virtual destructor
[C] An abstract base class can have non virtual destructor
[D] An abstract base class cannot have destructor

Answer: D. An abstract base class cannot have destructor

6. The conversion from basic data to class type can be done by .......
[A] Writing constructor
[B] Is not possible
[C] overloaded casting operator
[D] object of a class

Answer: A. Writing constructor

7. When a base class pointer points to derived class object?
[A] It can access only base class members
[B] It can access only derived class members
[C] Both base class & derived class members
[D] None

Answer: A. It can access only base class members

8. What is meant by multiple inheritance?
[A] Deriving a base class from derived class
[B] Deriving a derived class from base class
[C] Deriving a derived class from more than one base class
[D] None of the mentioned

Answer: C. Deriving a derived class from more than one base class

9. Which symbol is used to create multiple inheritance?
[A] Dot
[B] Comma
[C] Dollar
[D] None of the mentioned

Answer: B. Comma

10. what is Hybrid Inheritance?
[A] multiple inheritance
[B] multilevel inheritance
[C] multipath inheritance
[D] combination of a and b
[E] combination of a and c

Answer: D. combination of a and b


Comments: (Your feedback is valuable to us)

venky 7 months ago Reply

good


minhaj 1 year ago Reply

thanks
to admin


Thatiparthi Sivasankar Reddy 2 years ago Reply

i did nt see na


;