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.

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

82. Which class uses hierarchical inheritance in following code?
class A
{
 int a;
};
class B:class A
{
 int b;
};
class C:class A,class B
{
 int c;
};
class D:class A
{
 int d;
};
a. Class A,B,C
b. Class B,C,D
c. Class A,C,D
d. Class D,A,B
View Answer Report Discuss Too Difficult!
Answer: (d).Class D,A,B

83. Which among the following is correct for following code ?
abstract class A
{
 public Int a;
 public void disp();
};
class B:public A
{
 public: void dis()
 { 
  court<<a; 
 }
};
class C:private A
{
 public void incr()
 { 
  a++; 
 }
}
void main()
{
 B b.disp();
}
a. Compile time error
b. Runtime error
c. Program runs and o/p is 0
d. Program runs and o/p is garbage value
View Answer Report Discuss Too Difficult!
Answer: (a).Compile time error

84. 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
View Answer Report Discuss Too Difficult!
Answer: (a).As many as required

85. If one class have derived the base class privately then another class can’t derive the base class publically.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False

86. Which among the following is true ?
a. Hierarchical inheritance is subset of multiple inheritance
b. Hierarchical inheritance is strongest inheritance type
c. Hierarchical inheritance uses only 2 classes for implementation
d. Hierarchical inheritance allows inheritance of common features to more than one class
View Answer Report Discuss Too Difficult!
Answer: (d).Hierarchical inheritance allows inheritance of common features to more than one class

87. Hierarchical inheritance can be a subset of _________________
a. Hybrid inheritance
b. Multiple inheritance
c. Single level inheritance
d. Multilevel inheritance
View Answer Report Discuss Too Difficult!
Answer: (a).Hybrid inheritance

88. 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
View Answer Report Discuss Too Difficult!
Answer: (c).Hierarchical

89. 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
View Answer Report Discuss Too Difficult!
Answer: (a).Base class constructor

90. All the derived classes can access only few members of base class that other derived classes can’t access at same time, in hierarchical inheritance.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False