1.Combination of all types of Inheritance called?
a)Single Inheritance
b)Hybrid Inheritance
c)Multilevel Inheritance
d)Multiple Inheritances
2.Derived class is also called as?
a)Derived class
b)Child class
c)virtual class
d)None of the above
3.which type of members of a base class will never become the member of derived class.
a)protected
b)virtual
c)public
d)private
4.A derived class with several base classes, is called?
a)Multilevel Inheritance
b)MUltiple Inheritance
c)Hierarchical Inheritance
d)Single Inheritance
5.The process pf creating new classes from the existing base class called?
a)Single Inheritance
b)Multiple Inheritance
c)Hybrid Inheritance
d)Hierarchical Inheritance
6.The object of Abstract class can be created.
a)True
b)False
7.Which member cannot be accessed by the functions outside these two classes?
a)private
b)public
c)protected
d)None of the above
8.Abstract class is a class which has
a)More than one virtual function
b)Two or more pure virtual function
c)At least one pure virtual function
d)Only one virtual function
9.If base class constructor does not have any arguments, the derived class must have a constructor
function.
a)True
b)False
10.What is a pure virtual function in C++?
a)A virtual function defined in a base class
b)A virtual function declared in a base class
c)A function without definition in a base class
d)None of the above
11.Syntax of defining a pure virtual function
a)virtual return_type func() pure;
b)virtual return_type func() = 0;
c)virtual return_type func();
d)pure virtual return_type func();
12.In inheritance, which class can be derived from another derived class?
a)Hierarchical
b)Single
c)Multiple
d)Multilevel
13.A public member of a class can be accessed by its own objects using which operator?
a) ::
b) .
c) {}
d) ;
14.Both the public and protected members in protected derivation, the base class become
a)Public
b)Private
c)Protected
4)None of the above
15.When a base class is privately inherited by derived class, public members of the base class can only
be accessed by which type of the derived class?
a)Friend function
b)Member function
c)Virtual function
d)Non member function
16.When the inheritance is private, the private methods in base class are
a)Protected
b)Inaccible
c)Accessible
d)Public
17. Inheritance allow in C++ Program?
a)Creating a hierarchy of classes
b)Only one time use
c)Declaration of child class
d)All of the above
18.Which symbol is used to create multiple inheritance?
a)::
b),
c);
d).
19.In inheritance, order of execution of base class and derived class destructors are
a)Base to base
b)Base to derived
c)Derived to base
d)Derived to derived
20.In case of inheritance where both base and derived class are having constructors, when an object of
derived class is created then___________
a) constructor of derived class will be invoked first
b) constructor of base class will be invoked first
c) constructor of derived class will be executed first followed by base class
d) constructor of base class will be executed first followed by derived class
21. witch of the following is Syntax of class declaration
a. class class_name
:::::
];
b. class class_name
:::::
c. class class_name
:::::
);
d. class class_name
:::::
};
22. when Access specifier is public then
a. private mode: not inharited
Protected mode: not inarited
public mode: not inharited
b. Private mode: Protected
Protected mode: private
public mode: Protected
c. Private mode: public
Protected mode: private
public mode: Protected
d. non of this
23. when Access specifier is private then
a. Private mode: not inharited
Protected mode: not inarited
public mode: not inharited
b. Private mode: Protected
Protected mode: private
public mode: Protected
c. Private mode: public
Protected mode: private
public mode: Protected
d. non of this
24. witch type of inheritance is used in code
Class base
Member of base class
};
Class derive1:public/private/protected base
Member of derivei class
};
Class derive2
{
Member of derive2 class
};
Class hyb:public/private/protected derive1, public/private/protected derive2
Members of class
};
a.single inheritance
b.multilevel inheritance
c.multiple inheritance
d.hybrid inheritance
25. following code is related to
Class base1
Member of base class 1
};
Class derive1: public/private/protected base1
Member of derive class 1
};
Class derive2: public/private/protected basel
Member of derive class 2
};
a.single inheritance
b.multilevel inheritance
c.Hiererchical inheritance
d.hybrid inheritance
26. following code is related to
Class basel
Member of base classi
};
Class base2
Member of base class 2
};
Class derive: public/private/protected basel, public/private/protected base?
Member of derive class
};
a.single inheritance
b.multilevel inheritance
c.Hiererchical inheritance
d.hybrid inheritance
27 following code is related to
Class base
Member of base class
};
Class derive1: public/private/protected base
Member of derive class
};
Class derive2: public/private/protected derive1
Member of derive class
};
a.single inheritance
b.multilevel inheritance
c.Hiererchical inheritance
d.hybrid inheritance
2 8. following code is related to
Class base
Member of base class
};
Class derive: public/private/protected base
Member of derive class
};
a.single inheritance
b.multilevel inheritance
c.Hiererchical inheritance
d.hybrid inheritance
29. following code is related to
class classname
{
Virtual void method()=0;
};
a.single inheritance
b.abstract class
c.Hiererchical inheritance
d.hybrid inheritance
30. If base class constructor does not have any arguments,then ?
a.the derived class need not have a constructor function.
b.the derived class need to have a constructor function.
c.both
d.non of the above
31. If base class contain one or more argument then it is .......... for the derived class to have a .............
and pass the argument to the base class constructor
a. mandatory,constructor
b. mandatory,distructor
c. not mandatory,constructor
d. non of the above
32. Can we pass parameters to base class constructor though derived class or derived class constructor?
a. Yes
b. No
c. May Be
d. Can't Say
33 What are the things are inherited from the base class?
a. Constructor and its destructor
b. Operator=() members
c. Friends
d. All of the above
34 Which of the following advantages we lose by using multiple inheritance?
a. Dynamic binding
b. Polymorphism
c. Both Dynamic binding & Polymorphism
d. None of the mentioned
35 What will be the output of the following program?
class find {
public:
void print()
{ cout <<" In find"; }
};
class course : public find {
public:
void print() { cout <<" In course"; }
};
class tech: public course { };
int main(void)
tech t;
t.print();
return 0;
a. In find
b. In course
c. Compiler Error: Ambiguous call to print()
d. None of the above
36 Which among the following best defines single level inheritance?
a. A class inheriting a derived class
b. A class inheriting a base class
c. A class inheriting a nested class
d. A class which gets inherited by 2 classes
37 Which among the following is correct for a hierarchical inheritance?
a. Two base classes can be used to be derived into one single class
b. Two or more classes can be derived into one class
c. One base class can be derived into other two derived classes or more
d. One base class can be derived into only 2 classes
38 Which type of inheritance leads to diamond problem?
a. Single level
b. Multi-level
c. Multiple
d. Hierarchical
39 Which access type data gets derived as private member in derived class?
a. Private
b. Public
c. Protected
d. Protected and Private
40 Members which are not intended to be inherited are declared as ________________
a. Public members
b. Protected members
c. Private members
d. Private or Protected members