OOP Using C++ — MCQ Practice

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

📚 101 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
101 questions

Question 31

EN + हिं
GB What is the output: class A{public:virtual int f()=0; int g(){return f()*2;}}; class B:public A{public:int f(){return 5;}}; B b; cout<
IN आउटपुट क्या है: class A{public:virtual int f()=0; int g(){रिटर्न f()*2;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f(){वापसी 5;}}; बी बी; अदालत
10 10
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) B::f()=5; g()=5*2=10. Output: 10.
व्याख्या (हिन्दी) बी::एफ()=5; जी()=5*2=10. आउटपुट: 10.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 32

EN + हिं
GB What is the output: template T cube(T x){return x*x*x;} cout<
IN आउटपुट क्या है: टेम्पलेट टी क्यूब(टी एक्स){रिटर्न x*x*x;} कॉउट
278.0 278.0
Compile error संकलन त्रुटि
Undefined अपरिभाषित
27 8 27 8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) cube(3)=27, cube(2.0)=8.0. Output: 278.
व्याख्या (हिन्दी) घन(3)=27, घन(2.0)=8.0. आउटपुट: 278.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 33

EN + हिं
GB What is the output: class Stack{vectorv; public: void push(int x){v.push_back(x);} int top(){return v.back();} int size(){return v.size();}}; Stack s; s.push(1);s.push(2);s.push(3); cout<
IN आउटपुट क्या है: class Stack{vectorv; सार्वजनिक: शून्य पुश (int x) {v.push_back (x);} int टॉप() {रिटर्न v.back();} int आकार() {रिटर्न v.size();}}; ढेर एस; एस.पुश(1);एस.पुश(2);एस.पुश(3); अदालत
33 33
13 13
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) top=3, size=3. Output: 33.
व्याख्या (हिन्दी) शीर्ष=3, आकार=3. आउटपुट: 33.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 34

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

Question 35

EN + हिं
GB What is the output: auto add=[](int a,int b){return a+b;}; auto mul=[](int a,int b){return a*b;}; auto apply=[](auto f,int a,int b){return f(a,b);}; cout<
IN आउटपुट क्या है: auto add=[](int a,int b){return a+b;}; ऑटो mul=[](int a,int b){return a*b;}; स्वत: लागू=[](ऑटो एफ,इंट ए,इंट बी){रिटर्न एफ(ए,बी);}; अदालत
712 712
Compile error संकलन त्रुटि
Undefined अपरिभाषित
7 12 7 12
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) apply(add,3,4)=7; apply(mul,3,4)=12. Output: 712.
व्याख्या (हिन्दी) लागू करें(जोड़ें,3,4)=7; लागू करें(mul,3,4)=12। आउटपुट: 712.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 36

EN + हिं
GB What is the output: class Queue{dequed; public: void enq(int x){d.push_back(x);} int deq(){int x=d.front();d.pop_front();return x;} int size(){return d.size();}}; Queue q; q.enq(1);q.enq(2);q.enq(3); cout<
IN आउटपुट क्या है: class Queue{dequed; सार्वजनिक: void enq(int x){d.push_back(x);} int deq(){int x=d.front();d.pop_front();return x;} int size(){return d.size();}}; कतार क्यू; q.enq(1);q.enq(2);q.enq(3); अदालत
12 12
32 32
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) deq()=1; remaining size=2. Output: 12.
व्याख्या (हिन्दी) डेक()=1; शेष आकार=2. आउटपुट: 12.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 37

EN + हिं
GB What is the output: class A{public:virtual double compute(double x)=0;}; class Square:public A{public:double compute(double x)override{return x*x;}}; class Cube:public A{public:double compute(double x)override{return x*x*x;}}; vector ops={new Square,new Cube}; for(auto p:ops) cout<compute(3)<<' ';
IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल डबल कंप्यूट(डबल x)=0;}; वर्ग वर्ग:सार्वजनिक ए{सार्वजनिक:डबल कंप्यूट(डबल एक्स)ओवरराइड{रिटर्न x*x;}}; क्लास क्यूब: सार्वजनिक ए {सार्वजनिक: डबल कंप्यूट (डबल एक्स) ओवरराइड {रिटर्न x*x*x;}}; वेक्टर ऑप्स = {नया वर्ग, नया घन}; for(ऑटो पी:ऑप्स) कॉउट
9 27 9 27
3 9 3 9
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Square(3)=9, Cube(3)=27. Output: 9 27.
व्याख्या (हिन्दी) वर्ग(3)=9, घन(3)=27. आउटपुट: 9 27.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 38

EN + हिं
GB What is the output: template class Box{T v; public: Box(T x):v(x){} T get()const{return v;}}; Box a(5); Box b("hi"); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास बॉक्स{T v; सार्वजनिक: Box(T x):v(x){} T get()const{return v;}}; बॉक्स ए(5); बॉक्स बी('हाय'); अदालत
5hi 5हाय
Compile error संकलन त्रुटि
Undefined अपरिभाषित
hi5 हाई 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a.get()=5, b.get()=hi. Output: 5hi.
व्याख्या (हिन्दी) a.get()=5, b.get()=हाय। आउटपुट: 5हाय.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 39

EN + हिं
GB What is the output: class Iter{int i=0,n; public: Iter(int n):n(n){} bool hasNext(){return i
IN आउटपुट क्या है: class Iter{int i=0,n; सार्वजनिक: Iter(int n):n(n){} bool hasNext(){return i
012 012
123 123
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Returns 0,1,2. Output: 012.
व्याख्या (हिन्दी) 0,1,2 लौटाता है। आउटपुट: 012.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 40

EN + हिं
GB What is the output: struct Visitor{void operator()(int x){cout<<'I';} void operator()(string s){cout<<'S';}}; variant v=string("hi"); visit(Visitor{},v);
IN आउटपुट क्या है: struct विज़िटर{शून्य ऑपरेटर()(int x){cout
S एस
I मैं
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v holds string; Visitor::operator()(string) called. Output: S.
व्याख्या (हिन्दी) v स्ट्रिंग रखता है; विज़िटर::ऑपरेटर()(स्ट्रिंग) को बुलाया गया। आउटपुट: एस.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 41

EN + हिं
GB What is the output: class Logger{public:virtual void log(const string& m)=0;}; class ConsoleLogger:public Logger{public:void log(const string& m)override{cout<log("OK");
IN आउटपुट क्या है: क्लास लॉगर {सार्वजनिक: वर्चुअल शून्य लॉग (कॉन्स्ट स्ट्रिंग और एम) = 0;}; क्लास कंसोल लॉगर: सार्वजनिक लॉगर {सार्वजनिक: शून्य लॉग (कॉन्स्ट स्ट्रिंग और एम) ओवरराइड {काउट
OK ठीक है
Compile error संकलन त्रुटि
Undefined अपरिभाषित
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ConsoleLogger::log prints OK. Output: OK.
व्याख्या (हिन्दी) कंसोललॉगर::लॉग ठीक प्रिंट करता है। आउटपुट: ठीक है.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 42

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

Question 43

EN + हिं
GB What is the output: class Event{public:virtual void handle()=0;}; class Click:public Event{public:void handle()override{cout<<"Click";}}; class Key:public Event{public:void handle()override{cout<<"Key";}}; vector events={new Click,new Key}; for(auto e:events) e->handle();
IN आउटपुट क्या है: क्लास इवेंट{पब्लिक:वर्चुअल वॉयड हैंडल()=0;}; क्लास क्लिक:सार्वजनिक इवेंट{सार्वजनिक:शून्य हैंडल()ओवरराइड{काउट
ClickKey क्लिककुंजी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
KeyClick कुंजी क्लिक करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Click then Key. Output: ClickKey.
व्याख्या (हिन्दी) फिर कुंजी पर क्लिक करें। आउटपुट: क्लिककी.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 44

EN + हिं
GB What is the output: template T identity(T x){return x;} cout<
IN आउटपुट क्या है: टेम्पलेट T पहचान(T x){रिटर्न x;} कोउट
5A3.14 5ए3.14
Compile error संकलन त्रुटि
Undefined अपरिभाषित
5 A 3 5 ए 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Returns each value. Output: 5A3.14.
व्याख्या (हिन्दी) प्रत्येक मान लौटाता है. आउटपुट: 5A3.14.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 45

EN + हिं
GB What is the output: class Strategy{public:virtual int exec(int a,int b)=0;}; class Add:public Strategy{public:int exec(int a,int b){return a+b;}}; class Mul:public Strategy{public:int exec(int a,int b){return a*b;}}; Strategy*s=new Add; cout<exec(3,4); s=new Mul; cout<exec(3,4);
IN आउटपुट क्या है: class Strategy{public:virtual int exec(int a,int b)=0;}; कक्षा जोड़ें:सार्वजनिक रणनीति{सार्वजनिक:int exec(int a,int b){रिटर्न a+b;}}; क्लास मुल:सार्वजनिक रणनीति{सार्वजनिक:int exec(int a,int b){रिटर्न a*b;}}; रणनीति*s=नया जोड़ें; अदालत
712 712
Compile error संकलन त्रुटि
Undefined अपरिभाषित
7 12 7 12
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Add=7, Mul=12. Output: 712.
व्याख्या (हिन्दी) जोड़ें=7, मूल=12। आउटपुट: 712.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।