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

Question 1771

EN + हिं
1 1
2 2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) push_back(*p) slices B to A. v.back().f()=A::f()=1. Output: 1.
व्याख्या (हिन्दी) पुश_बैक(*पी) स्लाइस बी से ए. वी.बैक().एफ()=ए::एफ()=1. आउटपुट: 1.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1772

EN + हिं
GB What is the output: class A{public:virtual ~A(){} virtual void f()=0;}; class B:public A{public:void f()override{cout<<'B';}}; class C:public A{public:void f()override{cout<<'C';}}; vectorv={new B,new C,new B,new C}; int n=0; for(auto p:v) {p->f(); if(dynamic_cast(p))n++;} cout<
IN आउटपुट क्या है: वर्ग A{सार्वजनिक:वर्चुअल ~A(){} वर्चुअल शून्य f()=0;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: शून्य एफ() ओवरराइड {काउट
BCBC2 BCBC2
BCB2 बीसीबी2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) B,C,B,C printed; 2 B's. Output: BCBC2.
व्याख्या (हिन्दी) बी,सी,बी,सी मुद्रित; 2 बी. आउटपुट: BCBC2.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1773

EN + हिं
GB What is the output: class A{public:virtual int f(){return 1;} virtual int g(){return f()+1;}}; class B:public A{public:int f()override{return 2;}}; B b; cout<
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल इंट एफ(){रिटर्न 1;} वर्चुअल इंट जी(){रिटर्न एफ()+1;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी 2;}}; बी बी; अदालत
3 3
2 2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b.g()=A::g()=f()+1=B::f()+1=2+1=3. Output: 3.
व्याख्या (हिन्दी) b.g()=A::g()=f()+1=B::f()+1=2+1=3. आउटपुट: 3.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1774

EN + हिं
GB What is the output: class A{public:virtual void f()=0;}; struct B:A{void f()override{cout<<'B';}}; struct C:A{void f()override{cout<<'C';}}; auto apply=[](A& a){a.f();}; B b; C c; apply(b); apply(c);
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल वॉयड f()=0;}; संरचना बी:ए{शून्य एफ()ओवरराइड{काउट
BC ईसा पूर्व
CB सीबी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) apply(b)=B, apply(c)=C. Output: BC.
व्याख्या (हिन्दी) लागू करें (बी) = बी, लागू करें (सी) = सी। आउटपुट: बी.सी.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1775

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; A *arr[3]={new A,new B,new B}; for(auto p:arr)p->f();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
122 122
111 111
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A=1,B=2,B=2. Output: 122.
व्याख्या (हिन्दी) ए=1,बी=2,बी=2. आउटपुट: 122.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1776

EN + हिं
GB What is the output: class A{public:virtual int f(){return 1;}}; class B:public A{public:int f()override{return 2;}}; int apply(A* p,int n){int s=0;for(int i=0;i
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल इंट एफ(){रिटर्न 1;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी 2;}}; int लागू(A* p,int n){int s=0;for(int i=0;i
3 3
6 6
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) arr[i] accessed as A; all A::f()=1. Sum=3. Output: 3.
व्याख्या (हिन्दी) arr[i] को A के रूप में एक्सेस किया गया; सभी A::f()=1. योग=3. आउटपुट: 3.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1777

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<'A';}}; class B:public A{public:void f()override{cout<<'B';}}; A* make(int t){return t?new B:new A;} for(int i=0;i<3;i++){auto*p=make(i%2);p->f();delete p;}
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
ABB एबीबी
ABA आबा
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:make(0)=A:A; i=1:make(1)=B:B; i=2:make(0)=A:A. Output: ABA.
व्याख्या (हिन्दी) i=0:make(0)=A:A; i=1:make(1)=B:B; i=2:make(0)=A:A. आउटपुट: एबीए.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1778

EN + हिं

Question 1779

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<'A';} virtual void g()=0;}; class B:public A{public:void f()override{cout<<'B';} void g()override{cout<<'G';}}; B b; b.f(); b.g();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
BG बीजी
AG एजी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f()=B; g()=G. Output: BG.
व्याख्या (हिन्दी) एफ()=बी; जी()=जी. आउटपुट: बीजी.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1780

EN + हिं
GB What is the output: class A{public:int x=0; virtual void inc(){x++;}}; class B:public A{public:void inc()override{x+=5;}}; vectorv={new A,new B,new A}; for(auto p:v)p->inc(); int s=0; for(auto p:v)s+=p->x; cout<
IN आउटपुट क्या है: class A{public:int x=0; आभासी शून्य इंक(){x++;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:शून्य इंक()ओवरराइड{x+=5;}}; वेक्टरv={नया ए,नया बी,नया ए}; for(auto p:v)p->inc(); int s=0; for(auto p:v)s+=p->x; अदालत
7 7
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A.x=1; B.x=5; A.x=1. Sum=7. Output: 7.
व्याख्या (हिन्दी) A.x=1; बी.एक्स=5; ए.एक्स=1. योग=7. आउटपुट: 7.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1781

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<'A';} void g(){f();cout<<'G';}}; class B:public A{public:void f()override{cout<<'B';}}; B b; b.g();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
BG बीजी
AG एजी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f()=B::f()=B; then G. Output: BG.
व्याख्या (हिन्दी) f()=B::f()=B; फिर जी. आउटपुट: बीजी.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1782

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<'A';} ~A(){}}; class B:public A{public:void f()override{cout<<'B';}}; unique_ptrp=make_unique(); p->f();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
B बी
A
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p->f() virtual: B::f()=B. Output: B.
व्याख्या (हिन्दी) p->f() वर्चुअल: B::f()=B. आउटपुट: बी.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1783

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; A obj; B bobj; A* ptrs[]={&obj,&bobj,&obj}; for(A*p:ptrs)p->f();
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
121 121
111 111
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A=1,B=2,A=1. Output: 121.
व्याख्या (हिन्दी) ए=1,बी=2,ए=1. आउटपुट: 121.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1784

EN + हिं
GB What is the output: class A{public:virtual string name(){return "A";} string greet(){return "Hi "+name();}}; class B:public A{public:string name()override{return "B";}}; B b; cout<
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल स्ट्रिंग नेम(){रिटर्न "ए";} स्ट्रिंग ग्रीट(){रिटर्न "हाय "+नेम();}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:स्ट्रिंग नाम()ओवरराइड{वापसी "बी";}}; बी बी; अदालत
Hi B हाय बी
Hi A हाय ए
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) greet() calls virtual name(): B::name()=B. Output: Hi B.
व्याख्या (हिन्दी) greet() वर्चुअल नाम() को कॉल करता है: B::name()=B। आउटपुट: हाय बी.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1785

EN + हिं
GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; functionfp=[](A*p){p->f();}; fp(new A); fp(new B);
IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट
12 12
11 11
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Virtual dispatch: 1,2. Output: 12.
व्याख्या (हिन्दी) आभासी प्रेषण: 1,2. आउटपुट: 12.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।