C++ - QUESTIONS : PART 25
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.
void pointers
null pointers
this pointer
base pointer
SHOW ANSWER
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.
i and ii only
ii and iii only
i and iii only
All i, ii and iii
SHOW ANSWER
The important application of ………………… is to return the object it points to.
void pointers
null pointers
this pointer
base pointer
SHOW ANSWER
The pointer to function is known as …………………. function.
forward
pointer
callback
backward
SHOW ANSWER
We can manipulate a pointer with the indirection operator (*), which is also known as ……………………
reference operator
dereference operator
direction operator
indirection operator
SHOW ANSWER
Using the ………………………., we can change the contents of the memory location.
reference operator
dereference operator
direction operator
indirection operator
SHOW ANSWER
If we attempt to dereference an uninitialized pointer, it will ………………….. by referring to any other location in memory.
cause compile time error
run time error
cause run time error
executes
SHOW ANSWER
A virtual function that has no definition within the base class is called____________.
Pure virtual function
Pure static function
Pure Const function
Friend function
SHOW ANSWER
If abstract class is inherited by derived class, then_______________ .
Derived class should provide definition for all the pure virtual functions
Derived class also become abstract if fails to implement pure virtual functions
Objects of derived class can’t be created if it fails to implement pure virtual functions
All of these
SHOW ANSWER
If a class contains pure virtual function, then it is termed as____________________ .
Virtual class
Sealed class
Pure Local class
Abstract Class
SHOW ANSWER
When a virtual function is redefined by the derived class, it is called___________.
Overloading
Overriding
Rewriting
All of these
SHOW ANSWER
Which of the followings are true about Virtual functions?
They must be non-static member function of the class
They cannot be friends
Constructor Functions cannot be virtual
All of these
SHOW ANSWER
We can create objects of the abstract class.
True
False
SHOW ANSWER
Find the wrong statement/s about Abstract Class.
We can’t create its objects.
We can’t create pointers to an abstract class.
It contains at least one pure virtual function.
We can create references to an abstract class.
We can’t create pointers to an abstract class.
SHOW ANSWER
Runtime polymorphism is achieved only when a virtual function is accessed through a pointer to the base class.
True
False
SHOW ANSWER
Syntax for Pure Virtual Function is ______________ .
virtual void show()==0
void virtual show()==0
virtual void show()=0
void virtual show()=0
SHOW ANSWER
_______________ is a member function that is declared within a base class and redefined by derived class.
virtual function
static function
friend function
const member function
SHOW ANSWER
Syntax for Pure Virtual Function is ______________ .
virtual void show()==0
void virtual show()==0
virtual void show()=0
void virtual show()=0
SHOW ANSWER