Chapter 14: Classes and Objects — Online MCQ Test
COMPUTER SCIENCE · CLASS 11th · Tamil Nadu State Board
Practice Chapter 14: Classes and Objects with a free chapter-wise online MCQ test.
This chapter covers: This chapter details class specifications object declarations access specifiers and member functions in C++. Students learn constructors destructors and memory allocation for class....
AI-generated questions from basic to board-exam level, with instant results and explanations.
Chapter 14: Classes and Objects — Important Questions & Answers
Which keyword is used to declare a class in C++?
- A. struct
- B. class
- C. object
- D. define
Answer: B. class
In C++, the class keyword is used to define a new class type.
In C++, the class keyword is used to define a new class type.
By default, the members of a class in C++ are:
- A. Public
- B. Protected
- C. Private
- D. Global
Answer: C. Private
Class members are private by default unless otherwise specified.
Class members are private by default unless otherwise specified.
What is the function that is automatically called when an object of a class is created?
- A. Destructor
- B. Constructor
- C. Member function
- D. Main function
Answer: B. Constructor
A constructor is a special member function invoked automatically during object initialization.
A constructor is a special member function invoked automatically during object initialization.
Consider a class 'Box'. How are its data members accessed using an object 'b'?
- A. b->length
- B. b.length
- C. b::length
- D. Box.length
Answer: B. b.length
The dot operator (.) is used to access members of an object instance.
The dot operator (.) is used to access members of an object instance.
In the context of C++ memory, where are objects usually allocated if declared inside a function?
- A. Stack memory
- B. Heap memory
- C. Data segment
- D. Code segment
Answer: A. Stack memory
Local objects in functions are typically stored in the stack memory.
Local objects in functions are typically stored in the stack memory.