Inheritence - C++ Multiple Choice Questions(MCQs)& Answers

Questions
41 Run time polymorphism is achieved only when a ……………….. is accessed through a pointer to the base class.
A member function
B virtual function
C static function
D real function

Answer: Option [B]
42 If a ……………………… is defined in the base class, it need not be necessarily redefined in the derived class.
A member function
B virtual function
C static function
D real function

Answer: Option [B]
43 …………………………. is a function declared in a base class that has no definition relative to the base class.
A member function
B virtual function
C pure virtual function
D pure function

Answer: Option [B]
44 State whether the following statements about virtual functions are True or False.

i) A virtual function, equated to zero is called pure virtual function.

ii) A class containing pure virtual function is called an abstract class

A True, True
B True, False
C False, True
D False, False

Answer: Option [A]
45 The main objective of an abstract base class is to provide some traits to the derived class and to create a ………………………. required for achieving run time polymorphism.
A void pointers
B null pointers
C this pointer
D base pointer

Answer: Option [D]
46 . State whether the following statements about virtual functions is/are True. i) The virtual function must be member of some class ii) virtual functions cannot be static members iii) A virtual function can not be a friend of another class.
A i and ii only
B ii and iii only
C i and iii only
D All i, ii and iii

Answer: Option [A]
47 The important application of ………………… is to return the object it points to.
A void pointers
B null pointers
C this pointer
D base pointer

Answer: Option [C]
48 The pointer to function is known as …………………. function.
A forward
B pointer
C callback
D backward

Answer: Option [C]
49 We can manipulate a pointer with the indirection operator (*), which is also known as ……………………
A reference operator
B dereference operator
C direction operator
D indirection operator

Answer: Option [B]
50 Using the ………………………., we can change the contents of the memory location.
A reference operator
B dereference operator
C direction operator
D indirection operator

Answer: Option [B]
51 If we attempt to dereference an uninitialized pointer, it will ………………….. by referring to any other location in memory.
A cause compile time error
B run time error
C cause run time error
D executes

Answer: Option [C]