Virtual Function MCQs – C++

1.  A virtual function is a member function of which of the following class?

(A). Derived class

(B). Parent class

(c). base class

(D). Both A and B

Virtual functions must be members of some class

2. A virtual function is redefined in which of the following class?

(A). Derived class

(B). Parent class

(c). base class

(D). Both A and B

 

3. The virtual function is used to tell the compiler to perform ________?

(A). static linkage

(B). dynamic linkage

(c).  late binding

(D). Both B and C

 

4. Which of the following best describes the virtual function?

(A). Function overriding

(B). write a function in the child class that is already present in the parent class

(c). Run time polymorphism

(D). All of these

 

5. In late binding, function call is resolved during?

(A). runtime

(B). Compile time

(c). Infinite time

(D). None of these

 

6. Late binding can be implemented by which of the following?

(A). Function overloading

(B). Function overriding

(c). Virtual function

(D). B and C

 

7. Early binding can be implemented by which of the following?

(A). Virtual function

(B). Function overriding

(C). Function overloading

(D). B and C

 

8. Which statement is true about virtual functions?

(A). Virtual functions can be static members

(B). Virtual functions cannot be static members

(c). Virtual functions must be members of some class

(D). B and C

Virtual functions cannot be static members

 

9. Compiler can access the Virtual Functions with the help of_____ pointers?

(A). Class

(B). object

(c). Assigning address of child class object to parent class object and parent having a virtual function

(D). B and C

compiler can access the Virtual Functions through object pointers

10. The signatures of a virtual function of the base class and all the derived classes are ____ ?

(A). Different

(B). same

(c). Sometimes same, sometimes different

(D). None of these

The signatures of a virtual function of the base class and all the derived classes must be the same.

 

What is an example of function overloading?

(A). Two functions with different signatures

(B). Two functions with the same signatures

(c). Two functions with no signatures

(D). None of these

 

11. A program can have?

(A). Virtual Constructor

(B). Virtual Destructor

(c). Both of these

(D). None of these

A program can have virtual destructor
A program can have virtual destructor

Full Tutorial: Virtual Function in C++

Virtual Class MCQs – C++

OOP MCQs 

Programming C Plus Plus MCQs Homepage

shamil memory table