MCQOPTIONS
Saved Bookmarks
This section includes 17 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
All the derived classes can access only a few members of base class that other derived classes can’t access at same time, in hierarchical inheritance. |
| A. | True |
| B. | False |
| Answer» C. | |
| 2. |
Which class constructor is called first when an object of derived class is created? |
| A. | Base class constructor |
| B. | Derived class constructor |
| C. | Firstly created derived class constructor |
| D. | Last created derived class constructor |
| Answer» B. Derived class constructor | |
| 3. |
Which type of inheritance is most suitable for inheriting Same syllabus into different colleges with different streams? |
| A. | Multiple |
| B. | Single |
| C. | Hierarchical |
| D. | Multilevel |
| Answer» D. Multilevel | |
| 4. |
Hierarchical inheritance can be a subset of _________________ |
| A. | Hybrid inheritance |
| B. | Multiple inheritance |
| C. | Single level inheritance |
| D. | Multilevel inheritance |
| Answer» B. Multiple inheritance | |
| 5. |
If one class have derived the base class privately then another class can’t derive the base class publically. |
| A. | True |
| B. | False |
| Answer» C. | |
| 6. |
How many classes can be derived from the base class using hierarchical inheritance? |
| A. | As many as required |
| B. | Only 7 |
| C. | Only 3 |
| D. | Up to 127 |
| Answer» B. Only 7 | |
| 7. |
Which among the following is correct for following code? |
| A. | Compile time error |
| B. | Runtime error |
| C. | Program runs and o/p is 0 |
| D. | Program runs and o/p is garbage valueView Answer |
| Answer» B. Runtime error | |
| 8. |
Which class uses hierarchical inheritance in following code? |
| A. | Class A, B, C |
| B. | Class B, C, D |
| C. | Class A, C, D |
| D. | Class D, A, BView Answer |
| Answer» E. | |
| 9. |
Which access specifiers should be used so that all the derived classes restrict further inheritance of base class members? |
| A. | Private |
| B. | Public |
| C. | Protected |
| D. | Any inheritance type can be used |
| Answer» B. Public | |
| 10. |
Base class _______________ |
| A. | Can be made abstract |
| B. | Can’t be made abstract |
| C. | Must be abstract |
| D. | If made abstract, compile time error |
| Answer» B. Can’t be made abstract | |
| 11. |
How many classes must be there to implement hierarchical inheritance? |
| A. | Exactly 3 |
| B. | At least 3 |
| C. | At most 3 |
| D. | At least 1 |
| Answer» C. At most 3 | |
| 12. |
Each class can inherit the base class ________________ |
| A. | Independently using any inheritance |
| B. | Independently with private inheritance only |
| C. | With same type of inheritance |
| D. | With each class using different inheritance only |
| Answer» B. Independently with private inheritance only | |
| 13. |
Do members of base class gets divided among all of its child classes? |
| A. | Yes, equally |
| B. | Yes, depending on type of inheritance |
| C. | No, it’s doesn’t get divided |
| D. | No, it may or may not get divided |
| Answer» D. No, it may or may not get divided | |
| 14. |
Which among the following is best to define hierarchical inheritance? |
| A. | More than one classes being derived from one class |
| B. | More than 2 classes being derived from single base class |
| C. | At most 2 classes being derived from single base class |
| D. | At most 1 class derived from another class |
| Answer» B. More than 2 classes being derived from single base class | |
| 15. |
If one class have derived the base class privately then another class can’t derive the base class publically.$# |
| A. | True |
| B. | False |
| Answer» B. False | |
| 16. |
How many classes can be derived from the base class using hierarchical inheritance?$ |
| A. | As many as required |
| B. | Only 7 |
| C. | Only 3 |
| D. | Up to 127 |
| Answer» E. | |
| 17. |
Class A,B,C |
| A. | Class B,C,D |
| B. | Class A,C,D |
| C. | Class D,A,B |
| Answer» B. Class A,C,D | |