Monday, September 27, 2021


1. If i want to have common functions in a class and want to defer implementations of some other functions to derived classes, then we need to use

A.  An interface

B.  An abstract class

C.  A friend class

D.  A static class

2. Not using virtual destructor feature in a C++ object oriented programing can cause

A.  Memory leak

B.  An Issue in creating object of the class

C.  An issue in calling base class destructor

D.  None of these

3. Which concept is not available in C++?

A.  Virtual constructor

B.  Virtual destructor

C.  Virtual function

D.  Virtual Table

4. What is purpose of Virtual destructor?

A.  To maintain the call hierarchy of destructors of base and derived classes.

B.  Destructor can be virtual so that we can override the destructor of base class in derived class.

C.  Virtual destructor is to destroy the V Table.

D.  None of these

5. When VTABLE (Virtual table) get created for a class?

A.  Every class by default has virtual table

B.  When a Class Overrides the function of Base class

C.  When a class contains at least one virtual function.

D.  When a class is derived from a base class.

6. What is VPTR ( V Table pointer)?

A.  Holds the address of the V table

B.  Holds the address of the virtual functions

C.  Holds the address of pure virtual functions

D.  None of these

7. Who initializes the VPTR?

A.  Constructor initialize the VPTR

B.  By default, initiation is done

C.  Class itself

D.  None of these

8. In C++, virtual function is used in which concept?

A.  function overloading

B.  function overriding

C.  constructor overloading

D.  All of the above

9. In C++ code , variables can be passed to a function by

A.  Pass by value

B.  Pass by reference

C.  Pass by pointer

D.  All the above

10. Constant function in C++ can be declared as

A.  void display()

B.  void display() const

C.  const void display()

D.  void const display()

No comments:

Post a Comment

Popular Feed

Recent Story

Featured News