1.
A virtual function that has no definition within the base class is called____________.
(a) Pure virtual function
(b) Pure static function
(c) Pure Const function
(d) Friend function
2.
If a class contains pure virtual function, then it is termed as____________________ .
(a) Virtual class
(b) Sealed class
(c) Pure Local class
(d) Abstract Class
3.
When a virtual function is redefined by the derived class, it is called___________.
(a) Overloading
(b) Overriding
(c) Rewriting
(d) All of these
4.
Which of the followings are true about Virtual functions?
(a) They must be non-static member function of the class
(b) They cannot be friends
(c) Constructor Functions cannot be virtual
(d) All of these
The important points about Virtual functions are as follows:
• They must be non-static member function of the class.
• They cannot be friends.
• Constructor cannot be virtual but destructor can be virtual.
• It is used for late binding or runtime binding.
• The address of the virtual Function is placed in the VTABLE.
5.
Find the wrong statement/s about Abstract Class.
(a) We can’t create its objects.
(b) We can’t create pointers to an abstract class.
(c) It contains at least one pure virtual function.
(d) We can create references to an abstract class.
6.
Syntax for Pure Virtual Function is ______________ .
(a) virtual void show()==0
(b) void virtual show()==0
(c) virtual void show()=0
(d) void virtual show()=0
7.
Run time polymorphism can be achieved with______ .
(a) Virtual Base class
(b) Container class
(c) Virtual function
(d) Both a and c
8.
If abstract class is inherited by derived class, then_______________ .
(a) Derived class should provide definition for all the pure virtual functions
(b) Derived class also become abstract if fails to implement pure virtual functions
(c) Objects of derived class can’t be created if it fails to implement pure virtual functions
(d) All of these
9.
What is the error in the following code?
class t
{
virtual void print();
}
(a) No error.
(b) Function print() should be declared as static.
(c) Function print() should be defined.
(d) Class t should contain data members.
10.
Pick out the correct option.
(a) We cannot make an instance of an abstract base class
(b) We can make an instance of an abstract base class
(c) Both a & b
(d) None of the mentioned.