A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

21. Which type of inheritance results in diamond problem?
a. Single level
b. Hybrid
c. Hierarchical
d. Multilevel
View Answer Report Discuss Too Difficult!
Answer: (b).Hybrid

22. 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
View Answer Report Discuss Too Difficult!
Answer: (a).Single

23. Which among the following is correct for the following code?
class A
{  
 public : class B 
 { 
  public : B(int i): data(i)
  { 
  }
  int data;
 }
};
 class C: public A
{
 class D:public A::B{ };
};
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
View Answer Report Discuss Too Difficult!
Answer: (d).Single level inheritance is used, with both enclosing and nested classes

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
View Answer Report Discuss Too Difficult!
Answer: (b).Hybrid inheritance always contains multiple inheritance

25. 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
View Answer Report Discuss Too Difficult!
Answer: (d).Multiple inheritance among nested classes, and single level for enclosing classes

26. In hierarchical inheritance, all the classes involve some kind of inheritance. (True/ False)
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False

27. Which type of inheritance cannot involve private inheritance?
a. Single level
b. Multiple
c. Hybrid
d. All types can have private inheritance
View Answer Report Discuss Too Difficult!
Answer: (d).All types can have private inheritance

28. 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
View Answer Report Discuss Too Difficult!
Answer: (d).Any number of classes can be inherited

29. How many classes can be inherited by a single class in java?
a. Only 1
b. Only 27
c. Only 255
d. Only 1024
View Answer Report Discuss Too Difficult!
Answer: (a).Only 1

30. 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
View Answer Report Discuss Too Difficult!
Answer: (d).There is no limit

Page 3 of 11