MCQs – C++ Classes and Objects


Q) Class allows only one object of it to be created though out the program life cycle
  1. Singleton class
  2. Abstract class
  3. Friend class
  4. All classes

Answer: 1


Q) Statically allocated object for class A in C++ is
  1. A *obj = new A();
  2. A obj;
  3. A obj = new A();
  4. None

Answer: 2


Q) When you create an object of a class A like A obj ; then which one will be called automatically
  1. Constructor
  2. Destructor
  3. Copy constructor
  4. Assignment operator

Answer: 1


Q) When you create an object of a derived class in C++
  1. Derived class constructor is called first then the base class constructor
  2. Base class constructor is called first then derived class constructor
  3. base class constructor will not be called
  4. none of the above

Answer: 2


Q) The class in C++ which act only as a base class and object of it cannot be created is
  1. parent class
  2. super class
  3. abstract class
  4. none of the above

Answer: 3


Related Posts