Classes and Objects – MCQs July 22, 2025 by u930973931_answers 30 Score: 0 Attempted: 0/30 Subscribe 1. : What is a class in C++? (A) A data type (B) A user-defined data type containing data and functions (C) A function library (D) A memory location 2. : What is an object in C++? (A) A function (B) A pointer (C) An instance of a class (D) A header file 3. : What keyword is used to define a class? (A) define (B) object (C) class (D) module 4. : What is the default access specifier for class members? (A) public (B) protected (C) private (D) global 5. : How are class members accessed from an object? (A) object::member (B) object#member (C) object->member (D) object.member 6. : What is a constructor in C++? (A) A function used to destroy an object (B) A function used to allocate memory (C) A special function used to initialize objects (D) A static function 7. : Which of the following is true about constructors? (A) They can have a return type (B) They can be virtual (C) Their name is same as the class (D) They are called manually 8. : What is the function of a destructor in a class? (A) Create an object (B) Delete an object (C) Initialize class variables (D) Compile the program 9. : Which symbol is used to define scope resolution in C++? (A) :: (B) -> (C) . (D) # 10. : What is the keyword used to create an object dynamically? (A) new (B) malloc (C) create (D) alloc 11. : What is encapsulation? (A) Inheritance of functions (B) Binding data and functions together (C) Overloading of functions (D) Making variables global 12. : Which member function is invoked when an object is destroyed? (A) Constructor (B) Operator (C) Destructor (D) Friend 13. : Which of the following correctly declares an object of class Student? (A) class Student; (B) Student obj; (C) Student = new; (D) class obj.Student; 14. : Which keyword is used to make data members accessible outside the class? (A) internal (B) global (C) public (D) extern 15. : What is data hiding in OOP? (A) Storing data inside objects (B) Making data members private (C) Using static variables (D) Copying data to another class 16. : Can a class have multiple constructors? (A) Yes (B) No (C) Only if inherited (D) Only if static 17. : What happens if no constructor is defined in a class? (A) Compilation error (B) No object can be created (C) Compiler provides a default constructor (D) Object is abstract 18. : Which constructor is invoked when an object is copied? (A) Default constructor (B) Friend constructor (C) Copy constructor (D) Inline constructor 19. : What type of function is declared using the friend keyword? (A) Virtual function (B) Member function (C) Static function (D) Non-member function with access to private members 20. : Can we overload constructors in a class? (A) Yes (B) No (C) Only one is allowed (D) Only default is allowed 21. : Which function type does not belong to any object of the class? (A) Constructor (B) Static function (C) Virtual function (D) Inline function 22. : How many objects can be created from one class? (A) Only one (B) 255 (C) Limited to system memory (D) Ten 23. : What is the output of this statement? cout << “C++”; (A) Prints C++ (B) Error (C) Nothing (D) Prints “cout” 24. : Which of the following is the correct syntax to call a class function? (A) className->function(); (B) object.function(); (C) className.function(); (D) call.function(); 25. : Which keyword is used to stop data modification from a function? (A) public (B) void (C) const (D) return 26. : What is the use of the this pointer? (A) Points to the constructor (B) Refers to the current object (C) Refers to parent class (D) Used for inheritance 27. : Can we define functions inside a class in C++? (A) Yes (B) No (C) Only private ones (D) Only with friend functions 28. : Which class member is shared among all objects of a class? (A) Private member (B) Public member (C) Static member (D) Virtual member 29. : What is the special function used to clean up when an object is destroyed? (A) finalize() (B) delete() (C) destructor (D) remove() 30. : Can a class have both data and functions? (A) Yes (B) No (C) Only functions (D) Only data