OOP Using C++ — MCQ Practice

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

📚 1915 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1915 questions
1366
EN + हिं
1367
EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} bool operator<(const A& o)const{return x
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} बूल ऑपरेटर
A
1 1
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min uses operator<; min is c.x=1. Output: 1.
व्याख्या (हिन्दी) न्यूनतम ऑपरेटर का उपयोग करता है
1368
EN + हिं
GB What is the output: class A{public:int x=10; A(const A& o):x(o.x-1){} A()=default;}; A a; A b=a; A c=b; A d=c; cout<
IN आउटपुट क्या है: class A{public:int x=10; A(const A&o):x(o.x-1){} A()=default;}; ए ए; ए बी=ए; ए सी=बी; ए डी=सी; अदालत
A
10 9 8 7 10 9 8 7
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
option_b विकल्प_बी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) See explanation.
व्याख्या (हिन्दी) स्पष्टीकरण देखें.
1369
EN + हिं
GB What is the output: class A{public:int x=1; virtual int f(){return x;}}; class B:public A{public:int x=2; int f()override{return x;}}; B b; A&r=b; cout<
IN आउटपुट क्या है: class A{public:int x=1; वर्चुअल int f(){रिटर्न x;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int x=2; int f()ओवरराइड{रिटर्न x;}}; बी बी; ए&आर=बी; अदालत
A
21 21
B
22 22
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) r.f()=B::f()=2; r.x=A::x=1. Output: 21.
व्याख्या (हिन्दी) r.f()=B::f()=2; r.x=A::x=1. आउटपुट: 21.
1370
EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<'A';}}; class B:public A{public:void f()override{cout<<'B';}}; class C:public B{}; C c; c.f();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
A
B बी
B
A
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C inherits B::f which overrides A::f. Output: B.
व्याख्या (हिन्दी) C को B::f विरासत में मिला है जो A::f को ओवरराइड करता है। आउटपुट: बी.
1371
EN + हिं
GB What is the output: class A{public:int x=0; A(int v):x(v){} virtual void f(){cout<
IN आउटपुट क्या है: class A{public:int x=0; A(int v):x(v){} आभासी शून्य f(){cout
A
6 6
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A(3*2=6): x=6. f()=6. Output: 6.
व्याख्या (हिन्दी) ए(3*2=6): एक्स=6। एफ()=6. आउटपुट: 6.
1372
EN + हिं
GB What is the output: class A{public:void f(){cout<<'A';}}; class B:public A{public:using A::f; void f(int){cout<<'B';}}; B b; b.f();
IN आउटपुट क्या है: कक्षा ए {सार्वजनिक: शून्य एफ() {काउट
A
A
B
B बी
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) using A::f makes A::f(void) accessible. b.f()=A::f. Output: A.
व्याख्या (हिन्दी) A::f का उपयोग करने से A::f(void) पहुंच योग्य हो जाता है। b.f()=A::f. आउटपुट: ए.
1373
EN + हिं
GB What is the output: class A{public:A(int){cout<<'P';} virtual void f()=0;}; class B:public A{public:B():A(5){cout<<'B';} void f()override{cout<<'F';}}; B b; b.f();
IN आउटपुट क्या है: क्लास ए {पब्लिक: ए (इंट) {काउट
A
PBF पीबीएफ
B
BPF बीपीएफ
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A(5)=P; B()=B; b.f()=F. Output: PBF.
व्याख्या (हिन्दी) ए(5)=पी; बी()=बी; बी.एफ()=एफ. आउटपुट: पीबीएफ।
1374
EN + हिं
GB What is the output: class A{public:int x=1; virtual int g(){return x;}}; class B:public A{public:int x=2; int g()override{return x;}}; A *p=new B; cout<g()<<((B*)p)->x;
IN आउटपुट क्या है: class A{public:int x=1; वर्चुअल int g(){रिटर्न x;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int x=2; int g()ओवरराइड{वापसी x;}}; ए *पी=नया बी; अदालत
A
22 22
B
21 21
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p->g()=B::g()=B::x=2; ((B*)p)->x=2. Output: 22.
व्याख्या (हिन्दी) p->g()=B::g()=B::x=2; ((बी*)पी)->x=2. आउटपुट: 22.
1375
EN + हिं
GB What is the output: class A{public:virtual ~A(){cout<<'A';}}; class B:public A{public:~B()override{cout<<'B';}}; class C:public B{public:~C()override{cout<<'C';}}; A*p=new C; delete p;
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल ~ए(){काउट
A
CBA सीबीए
B
ABC एबीसी
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~C, ~B, ~A in order. Output: CBA.
व्याख्या (हिन्दी) ~सी, ~बी, ~ए क्रम में। आउटपुट: सीबीए.
1376
EN + हिं
GB What is the output: class A{public:int x=0;}; class B:public A{public:int x=1;}; class C:public A{public:int x=2;}; class D:public B,public C{}; D d; cout<
IN आउटपुट क्या है: class A{public:int x=0;}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int x=1;}; कक्षा सी:सार्वजनिक ए{सार्वजनिक:int x=2;}; कक्षा डी:सार्वजनिक बी,सार्वजनिक सी{}; डी डी; अदालत
A
12 12
B
01 01
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) d.B::x=1; d.C::x=2. Output: 12.
व्याख्या (हिन्दी) d.B::x=1; d.C::x=2. आउटपुट: 12.
1377
EN + हिं
GB What is the output: struct A{virtual void f(){cout<<1;}}; struct B:A{void f()override{cout<<2;}}; struct C:A{void f()override{cout<<3;}}; struct D:B,C{}; D d; d.B::f(); d.C::f();
IN आउटपुट क्या है: struct A{virtual void f(){cout
A
23 23
B
12 12
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) d.B::f()=2; d.C::f()=3. Output: 23.
व्याख्या (हिन्दी) d.B::f()=2; d.C::f()=3. आउटपुट: 23.
1378
EN + हिं
GB What is the output: class A{protected:int x=5;}; class B:public A{public: int getX(){return x;}}; class C:public A{public: int getX(){return x+1;}}; B b; C c; cout<
IN आउटपुट क्या है: class A{protected:int x=5;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: int getX() {वापसी x;}}; कक्षा सी:सार्वजनिक ए{सार्वजनिक: int getX(){रिटर्न x+1;}}; बी बी; सी सी; अदालत
A
56 56
B
55 55
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b.getX()=5; c.getX()=6. Output: 56.
व्याख्या (हिन्दी) b.getX()=5; c.getX()=6. आउटपुट: 56.
1379
EN + हिं
GB What is the output: class A{public:virtual int f(int x){return x;}}; class B:public A{public:int f(int x)override{return x*2;}}; class C:public B{public:int f(int x)override{return x*3;}}; A *p=new C; cout<f(5);
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल इंट एफ(इंट x){रिटर्न x;}}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: int f (int x) ओवरराइड {वापसी x * 2;}}; कक्षा सी:सार्वजनिक बी{सार्वजनिक:int f(int x)ओवरराइड{रिटर्न x*3;}}; ए *पी=नया सी; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C::f(5)=15. Output: 15.
व्याख्या (हिन्दी) सी::एफ(5)=15. आउटपुट: 15.
1380
EN + हिं
1366–1380 of 1915