OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 107 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
107 questions
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.
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 संकलन त्रुटि
D
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.
106–107 of 107