Object Oriented Programming interview questions part 26
Object Oriented Programming interview questions part 26
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Which Class is having highest degree of abstraction in multilevel inheritance of 5 levels?
Correct Answer is : Class at 1st level
2. If all the classes use private inheritance in multilevel inheritance then ______________
Correct Answer is : Each class can access only non-private members of its parent
3. Multilevel inheritance allows _________________ in the program.
Correct Answer is : As many levels of inheritance as required
4. What is minimum number of levels for a implementing multilevel inheritance?
Correct Answer is : 3
5. In multilevel inheritance one class inherits _______________
Correct Answer is : Only one class
6. All the classes must have all the members declared private to implement multilevel inheritance.
Correct Answer is : FALSE
7. Can abstract classes be used in multilevel inheritance?
Correct Answer is : Yes, always
8. How many abstract classes can be used in multilevel inheritance?
Correct Answer is : At least one less than number of levels
9. If all the classes used parameterized constructors and no default constructor then, ___________
Correct Answer is : Object of lower level classes must call parent class constructors explicitly
10. In multilevel inheritance, which is the most significant feature of OOP used?
Correct Answer is : Code reusability
11. Does following code show multiple inheritance?
class A
{
int a;
};
class B
{
int b;
};
class C:public A, public B
{
int c;
};
class D:public C
{
int d;
};
Correct Answer is : No, multiple inheritance is used with class A, B and C
12. Is it compulsory for all the classes in multilevel inheritance to have constructors defined explicitly if only last derived class object is created?
Correct Answer is : No, it not necessary
13. Multiple inheritance is ____________________
Correct Answer is : When a class is derived from two or more classes
14. Which problem arises due to multiple inheritance, if hierarchical inheritance is used previously for its base classes?
Correct Answer is : Diamond
15. How many classes should a program contain to implement the multiple inheritance?
Correct Answer is : At least 3
16. Which programming language restricts the use of multiple inheritance?
Correct Answer is : Java
17. Is it possible to have all the abstract classes as base classes of a derived class from those?
Correct Answer is : Yes, only if derived class implements all the methods
18. If class A inherits class B and class C as “class A: public class B, public class C {// class body ;}; ”, which class constructor will be called first?
Correct Answer is : Class B
19. Why does diamond problem arise due to multiple inheritance?
Correct Answer is : Methods with same name creates ambiguity and conflict
20. How many base classes can a derived class have which is implementing multiple inheritance?