MCQs – C++ Classes and Objects

(Last Updated On: March 13, 2019)
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
View Answer
Answer: D

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
View Answer
Answer: A


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
View Answer
Answer: A

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

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