106 Question 106 EN + हिं GB What is the output: class A{int x; public:A(int v):x(v){} A twice()const{return {x*2};} A inc()const{return {x+1};} int get()const{return x;}}; A a(3); cout< IN आउटपुट क्या है: class A{int x; सार्वजनिक:ए(int v):x(v){} A twos()const{return {x*2};} A inc()const{return {x+1};} int get()const{return x;}}; ए ए(3); अदालत A 14 14 B 12 12 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 3*2=6; 6+1=7; 7*2=14. Output: 14. व्याख्या (हिन्दी) 3*2=6; 6+1=7; 7*2=14. आउटपुट: 14. 🎯 Exam Perspective OOP Using C++ ("Encapsulation" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{int x=0; public:void f(){x+... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
107 Question 107 EN + हिं GB What is the output: class A{int x=0; public:void f(){x+=2;} void g(){f();f();} void h(){g();g();} int get()const{return x;}}; A a; a.h(); cout< IN आउटपुट क्या है: class A{int x=0; सार्वजनिक:void f(){x+=2;} void g(){f();f();} void h(){g();g();} int get()const{return x;}}; ए ए; ए.एच(); अदालत A 8 8 B 4 4 C Compile error Compile error D Undefined Undefined ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) h: g,g. g: f,f. Each f: x+=2. 4 calls: x=8. Output: 8. व्याख्या (हिन्दी) एच: जी, जी. जी: एफ,एफ। प्रत्येक f: x+=2. 4 कॉल: x=8. आउटपुट: 8. 🎯 Exam Perspective यह सवाल OOP Using C++ ("Encapsulation" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{int x; public:A(int v):x(v)... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)