Object Oriented Programming interview questions part 19
Object Oriented Programming interview questions part 19
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What will be the output of the program?
extern int var;
int main(void)
{
var = 10;
var++;
cout<
Correct Answer is : Compile time error
2. If the definition is given in the header file that we include then ________________
Correct Answer is : The program can run successfully
3. If extern variable is initialized with the declaration then _______________________
Correct Answer is : There is no need to include any other header file for definition
4. Why are functions extern by default?
Correct Answer is : Because functions are always private
5. Which among the following is best to define hierarchical inheritance?
Correct Answer is : More than one classes being derived from one class
6. Do members of base class gets divided among all of its child classes ?
Correct Answer is : No, it’s doesn’t get divided
7. Each class can inherit the base class ________________
Correct Answer is : Independently using any inheritance
8. How many classes must be there to implement hierarchical inheritance ?
Correct Answer is : At least 3
9. Base class _______________
Correct Answer is : Can be made abstract
10. Which access specifiers should be used so that all the derived classes restrict further inheritance of base class members?
Correct Answer is : Private
11. 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;
};
Correct Answer is : Class D,A,B
12. 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();
}
Correct Answer is : Compile time error
13. How many classes can be derived from the base class using hierarchical inheritance?
Correct Answer is : As many as required
14. If one class have derived the base class privately then another class can’t derive the base class publically.
Correct Answer is : FALSE
15. Which among the following is true ?
Correct Answer is : Hierarchical inheritance allows inheritance of common features to more than one class
16. Hierarchical inheritance can be a subset of _________________
Correct Answer is : Hybrid inheritance
17. Which type of inheritance is most suitable for inheriting Same syllabus into different colleges with different streams?
Correct Answer is : Hierarchical
18. Which class constructor is called first when an object of derived class is created?
Correct Answer is : Base class constructor
19. 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.
Correct Answer is : FALSE
20. Which among the following best defines the hybrid inheritance?
Correct Answer is : Combination of two or more inheritance types