MCQs – C++ Classes and Objects


Q) Correct way of creating an object of a class called Car is
  1. Car obj;
  2. Car *obj = new Car();
  3. Only B
  4. A & B both

Answer: 4

Both Car obj; and Car *obj = new Car() are valid way to create an object of the class.


Q) In C++, Class object created statically(e.g. Car obj; and dynamically (Car *obj = new Car() ; ) are stored in memory
  1. Stack, heap
  2. Heap, heap
  3. Heap, stack
  4. Stack, stack

Answer: 1


Q) True statement about Class and structure in C++ is
  1. Default access specifier is private in class and public in structure
  2. Way of creating objects of class and structure are different
  3. Way of inheriting class and structure are different
  4. None

Answer: 1


Q) In C++ programming, cout is a/an
  1. Function
  2. Operator
  3. Object
  4. macro

Answer: 3


Q) Which is Abstract Data Type in C++
  1. Class
  2. Int
  3. Float
  4. array

Answer: 1


Related Posts