Polymorphism & Inheritance MCQs in OOP For Exams Part 2. This mcqs helps in cracking competitive exams, placements exams and other university SPPU online exams 2020-21.
1 How many access specifiers are there in c++?
A 2
B 3
C 5
D 4
Answer B
2 Where we have to use an abstract class?
A in base class only
B in derived class only
C both and b
D None of the above
Answer A
3 For what we can apply access
A function
B data member
C none of the above specifier
D both a and c
Answer D
4 What is default access specifier for class?
A public
B protected
C private
D none of the above
Answer C
5 We have to define a constructor for the derived class must be required____.
A if base class constructor does not require arguments
B if base/parent class constructor required arguments
C no need
D always
Answer B
6 Use of the friend function is___.
A the class allowing access to another class
B the private section of a class
C the public section of the class
D all of the above
Answer D
7 If an attribute is private define then which method can have access to it
A only static function
B only functions of that class
C only method in that package
D none of the above
Answer B
8 What is syntax of deriving a new class from base class is___.
A class name, new class name
B new class name, base class name
C class name: access specifier class name
D none of the above
Answer C
9 Which constructor will initialize the base class data member
A base class
B derived class
C derived derived class
D none of these
Answer A
10 Inheritance can be done using :: symbol
A True
B False
Answer B
11 When we derived a new class using more than one class then type of inheritance is known
as____.
A multiple inheritance
B single inheritance
C hybrid inheritance
D multilevel inheritance
Answer A
12 When class B is derive from A , and class C is derived from B, this kind of inheritance is
known as ______.
A multiple inheritance
B single inheritance
C hybrid inheritance
D multilevel inheritance
Answer D
13 The base class will provide you__________.
A specific objects than the derived class
B more generalized version of derived class
C empty template of base class
D all of the above
Answer B
14 Pick up the correct statement form following
i)we have to use abstract keyword to define the abstract class
ii)inheritance allows multilevel class hierarchies more than two levels also
iii)reusability is supported by derivation
iv) we can change the meaning of operator during operator overloading
A i only
B ii only
C i and ii only
D ii and iii only
Answer D
15 What does derived class does not inherit from the base class
i)constructor
ii)destructor
iii)operator=()
iv)friends
A i and ii
B ii and iii
C only i, iii and iv
D all of the above
Answer D
16 Choose the correct the statement from following
i)inheritance supported in terms of single, multiple , multilevel ,hybrid inheritance
ii) polymorphisms is supported by function overloading , operator overloading and
virtual function
iii) abstraction is not supported by c++
A i is correct
B only ii is correct
C i and ii is correct
D none of the above
Answer C
17 _____types of classes in c++.
A 1
B 2
C 3
D 4
Answer C
18 :_______is used to define a pure virtual function.
A $
B ^
C =0
D #
Answer C
19 Pick up the correct statement
A a base class may have more than one class
B derived class can be derived from more than one class
C both a and b
D none of the above
Answer C
20 class A: public B, public C is a type of inheritance
A Single
B Multiple
C Multilevel
D Hybrid
Answer B
21 When we have to use the mutable keyword
A data member to change within a const member function
B not allow the data member to change within a const member function
C it will copy the values of the variable
D none of the above mentioned
Answer A
22 choose the correct statement
A destructor cannot be inherited
B private member not inherited to derived class
C constructor cannot inherited
D a and c
Answer D
23 Use of function or operator to act different ways on different data type is called as
A derivation
B inheritance
C polymorphisms
D none of the above
Answer C
24 Choose the correct statement
A Constructor has a return type
B constructor always define in public scope
C constructor has same name that of class name
D b and c
Answer D
25 overloading of a prefix increment operator by means of a member function
takes_________.
A one argument
B two argument
C no argument
D none of the above
Answer C
26 Pick up the correct statement
i)abstract type of class should contain at least one virtual function
ii)we can create an object of abstract class
iii)abstract class is used to provide an interface to subclasses
iv)abstract class can also have normal function
A i and ii only
B i , ii, and iii only
C i ,iii and iv
D all of the above
Answer D
27 What is function overloading
A we have to use same function name but different parameter
B different function name but same parameter
C both a and b
D none of the above
Answer A
28 Virtual base class is used to ____.
A to perform operator overloading
B to perform function overloading
C to remove ambiguity in multiple inheritance
D all of the above
Answer C
29 Pick up the correct statement
A protected member from base class can be accessed by own class and its all subclasses
B protected member are not inherited by any other class
C Protected member are combination of public and private access member
D all of the above
Answer D
30 pick up the correct statement
A base class and derived class can have their own constructor
B base class and derived class can have their own destructor
C neither a or neither b
D both a and b
Answer D