Q1
What is the purpose of a constructor in C++?
easyCorrect Answer: To initialize an object's data members automatically when the object is created
Explanation:
A constructor shares the same name as its class and runs automatically whenever a new object is instantiated, ensuring the object starts in a valid, properly initialized state.