Classes and Objects Interview Questions

    Question 1C++ OOPS - Class Definition

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

    Question 2C++ OOPS - Object Creation

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

    Question 3C++ OOPS - Access Specifiers

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

    Question 4C++ OOPS - Member Function Declaration

    Where can member functions of a class be defined?

    Question 5C++ OOPS - Object Access

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

    Question 6C++ OOPS - Pointer to Object

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

    Question 7C++ OOPS - Constructors

    What is true about constructors in C++?

    Question 8C++ OOPS - Destructor

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

    Question 9C++ OOPS - Object Initialization

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

    Question 10C++ OOPS - Object Lifetime

    When is a destructor of a class called automatically?