1. What is a constructor in C++? A. A function used to create objects B. A special member function that initializes objects C. A function used to access class members D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
2. Which access specifier allows constructors to be called from anywhere in the program in C++? A. friend B. protected C. public D. private Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
3. What happens if a class does not explicitly declare any constructors in C++? A. A compilation error occurs B. The class cannot be instantiated C. The class is initialized with default values D. A default constructor is provided by the compiler Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
4. What is the purpose of a destructor in C++? A. A special member function that destroys objects B. A function used to create objects C. A function used to initialize objects D. A function used to access class members Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
5. What is the purpose of the 'explicit' keyword before a constructor in C++? A. To mark the constructor as static B. To specify the return type of the constructor C. To allow implicit conversions during object initialization D. To prevent implicit conversions during object initialization Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
6. Which keyword is used to prevent inheritance in C++? A. override B. virtual C. final D. sealed Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
7. What is the difference between a shallow copy and a deep copy in C++? A. Shallow copy is performed using copy constructors, while deep copy is performed using assignment operators B. Shallow copy copies only the memory addresses of the objects, while deep copy copies the actual content C. Shallow copy is faster than deep copy D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
8. What is the process of hiding the implementation details of a class and showing only the necessary features to the outside world called in C++? A. Abstraction B. Polymorphism C. Encapsulation D. Inheritance Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
9. What is a constructor initialization list in C++? A. A list of destructor calls B. A list of initializations for member variables C. A list of default arguments for the constructor D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
10. What is the access specifier that allows members of a class to be accessed from anywhere in the program in C++? A. private B. protected C. internal D. public Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board