

MCQOPTIONS
Saved Bookmarks
This section includes 24 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. |
If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go on? |
A. | Only till class C |
B. | Only till class J |
C. | Only till class Z |
D. | There is no limit |
Answer» E. | |
2. |
How many classes can be inherited by a single class in java? |
A. | Only 1 |
B. | Only 27 |
C. | Only 255 |
D. | Only 1024 |
Answer» B. Only 27 | |
3. |
How many classes can be inherited by a single class in multiple inheritance (C++)? |
A. | Only 2 |
B. | Only 27 |
C. | Only 1024 |
D. | Any number of classes can be inherited |
Answer» E. | |
4. |
Which type of inheritance cannot involve private inheritance? |
A. | Single level |
B. | Multiple |
C. | Hybrid |
D. | All types can have private inheritance |
Answer» E. | |
5. |
In hierarchical inheritance, all the classes involve some kind of inheritance. |
A. | True |
B. | False |
Answer» C. | |
6. |
If class A has two nested classes B and C. Class D has one nested class E, and have inherited class A. If E inherits B and C, then ________________ |
A. | It shows multiple inheritance |
B. | It shows hierarchical inheritance |
C. | It shows multiple inheritance |
D. | Multiple inheritance among nested classes, and single level for enclosing classes |
Answer» E. | |
7. |
If 6 classes uses single level inheritance with pair classes (3 pairs), which inheritance will this be called? |
A. | Single |
B. | Multiple |
C. | Hierarchical |
D. | Multilevel |
Answer» B. Multiple | |
8. |
Which type of inheritance results in the diamond problem? |
A. | Single level |
B. | Hybrid |
C. | Hierarchical |
D. | Multilevel |
Answer» C. Hierarchical | |
9. |
How many types of inheritance can be used at a time in a single program? |
A. | Any two types |
B. | Any three types |
C. | Any 4 types |
D. | Any type, any number of times |
Answer» E. | |
10. |
Which among the following best describes multiple inheritance? |
A. | Two classes being parent of any other classes |
B. | Three classes being parent of other classes |
C. | More than one class being parent of other child classes |
D. | More than one class being parent of single child |
Answer» E. | |
11. |
How many types of inheritance are possible in C++? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» E. | |
12. |
Which method in the code below is single level inherited? |
A. | Class A |
B. | Class B |
C. | Class C |
D. | None |
Answer» C. Class C | |
13. |
Output of following program? |
A. | B salary is: 4000.0Bonus of B is: 10000 |
B. | B salary is 10000Bonus of B is: 4000.0 |
C. | Compile time error |
D. | Runtime error |
Answer» B. B salary is 10000Bonus of B is: 4000.0 | |
14. |
Which type of inheritance is illustrated by the following code? |
A. | Single level |
B. | Multilevel and single level |
C. | Hierarchical |
D. | Hierarchical and single level |
Answer» D. Hierarchical and single level | |
15. |
Which among the following is correct for the following code? |
A. | Multi-level inheritance is used, with nested classes |
B. | Multiple inheritance is used, with nested classes |
C. | Single level inheritance is used, with enclosing classes |
D. | Single level inheritance is used, with both enclosing and nested classes |
Answer» E. | |
16. |
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,B |
Answer» E. | |
17. |
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 value |
Answer» B. Runtime error | |
18. |
Does following code show multiple inheritance? |
A. | Yes, class C and class D |
B. | Yes, All together it’s multilevel |
C. | No, 4 classes are used |
D. | No, multiple inheritance is used with class A, B and C |
Answer» E. | |
19. |
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 | |
20. |
If object of lowest level class is created ( last derived class ), _________________ of its parent class constructors are called. |
A. | Few |
B. | All |
C. | Only parent and parent |
D. | Base and Derived |
Answer» D. Base and Derived | |
21. |
Which among the following is true? |
A. | Java supports all types of inheritance |
B. | Java supports multiple inheritance |
C. | Java doesn’t support multiple inheritance |
D. | Java doesn’t support inheritance |
Answer» D. Java doesn’t support inheritance | |
22. |
Which among the following is false? |
A. | If one class inherits the inherited class in single level inheritance, it is multi-level inheritance |
B. | Hybrid inheritance always contains multiple inheritance |
C. | Hierarchical inheritance involves inheriting same class into more than one classes |
D. | Hybrid inheritance can involve any types of inheritance together |
Answer» C. Hierarchical inheritance involves inheriting same class into more than one classes | |
23. |
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 | |
24. |
Which among the following is false?$ |
A. | If one class inherits the inherited class in single level inheritance, it is multi-level inheritance |
B. | Hybrid inheritance always contains multiple inheritance |
C. | Hierarchical inheritance involves inheriting same class into more than one classes |
D. | Hybrid inheritance can involve any types of inheritance together |
Answer» C. Hierarchical inheritance involves inheriting same class into more than one classes | |