🔹 India's Most Trusted MCA Coaching 💻 Live + Recorded Classes | 👨🏫 Expert Faculty 📝 All India Test Series | 🎯 Personal Mentorship 🥈 NIMCET AIR 2: Ayush Garg
Explanation:
int Demo::count = 0; initializes the static variable count to 0.
int Demo::count = 0;
count
Demo var1; → constructor is called once → count = 1.
Demo var1;
count = 1
Demo var2[5]; → constructor is called 5 times (for each element in the array) → count = 6.
Demo var2[5];
count = 6
Since count is static, it is shared among all objects.
Finally, cout << var1.count; prints 6.
cout << var1.count;
? Correct answer: (A) 6 ✅
Aspire Study Online Test Series, Information About Examination, Syllabus, Notificationand More.
Get MCA test series, questions & instant updates!