Classes and Objects Interview Questions

    Question 1: C++ OOPS - Class Definition

    Which keyword is used to define a class in C++?

    Question 2: C++ OOPS - Object Creation

    Which of the following correctly creates an object of class Car?

    Question 3: C++ OOPS - Access Specifiers

    By default, members of a C++ class are:

    Question 4: C++ OOPS - Member Function Declaration

    Where can member functions of a class be defined?

    Question 5: C++ OOPS - Object Access

    Which operator is used to access class members via an object?

    Question 6: C++ OOPS - Pointer to Object

    If Student *ptr; is a pointer to a Student object, how can we call its function show()?

    Question 7: C++ OOPS - Constructors

    What is true about constructors in C++?

    Question 8: C++ OOPS - Destructor

    Which symbol is used before the class name to define a destructor?

    Question 9: C++ OOPS - Object Initialization

    Which of the following initializes an object car of class Car with a constructor taking two arguments?

    Question 10: C++ OOPS - Object Lifetime

    When is a destructor of a class called automatically?