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 91

EN + हिं
B बी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
A
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) B::f()=B. Output: B.
व्याख्या (हिन्दी) बी::एफ()=बी. आउटपुट: बी.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 92

EN + हिं
GB What is the output: template auto sumTuple(tuplet){return apply([](auto...xs){return (xs+...);},t);} cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो sumTuple(tuplet){return apply([](auto...xs){return (xs+...);},t);} cout
15 15
Compile error संकलन त्रुटि
Undefined अपरिभाषित
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 93

EN + हिं
GB What is the output: class Cache{mapm; functionf; public:Cache(functionfn):f(fn){} int get(int x){if(!m.count(x))m[x]=f(x);return m[x];}}; Cache sq([](int x){return x*x;}); cout<
IN आउटपुट क्या है: class Cache{mapm; फ़ंक्शनएफ; public:Cache(functionfn):f(fn){} int get(int x){if(!m.count(x))m[x]=f(x);return m[x];}}; कैश sq([](int x){रिटर्न x*x;}); अदालत
25259 25259
Compile error संकलन त्रुटि
Undefined अपरिभाषित
25 25 9 25 25 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sq(5)=25 (computed); sq(5)=25 (cached); sq(3)=9. Output: 25259.
व्याख्या (हिन्दी) वर्ग(5)=25 (गणना); वर्ग(5)=25 (कैश्ड); वर्ग(3)=9. आउटपुट: 25259.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 94

EN + हिं
GB What is the output: class A{public:virtual int eval()const=0;}; class Const:public A{int v;public:Const(int x):v(x){} int eval()const override{return v;}}; class Mul:public A{A *l,*r;public:Mul(A*a,A*b):l(a),r(b){} int eval()const override{return l->eval()*r->eval();}}; A*e=new Mul(new Const(3),new Mul(new Const(4),new Const(5))); cout<eval();
IN आउटपुट क्या है: class A{public:virtual int eval()const=0;}; वर्ग स्थिरांक:सार्वजनिक A{int v;सार्वजनिक:Const(int x):v(x){} int eval()const ओवरराइड{रिटर्न v;}}; क्लास मुल:पब्लिक ए{ए *एल,*आर;पब्लिक:मुल(ए*ए,ए*बी):एल(ए),आर(बी){} int eval()const ओवरराइड{रिटर्न l->eval()*r->eval();}}; ए*ई=नया मूल(नया स्थिरांक(3),नया मूल(नया स्थिरांक(4),नया स्थिरांक(5))); अदालत
60 60
20 20
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4*5=20; 3*20=60. Output: 60.
व्याख्या (हिन्दी) 4*5=20; 3*20=60. आउटपुट: 60.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 95

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

Question 96

EN + हिं
GB What is the output: class Protocol{public:virtual void send(string)=0; virtual string recv()=0;}; class Echo:public Protocol{string last; public:void send(string s)override{last=s;} string recv()override{return last;}}; Echo e; e.send("hello"); cout<
IN आउटपुट क्या है: क्लास प्रोटोकॉल{पब्लिक:वर्चुअल वॉयड सेंड(स्ट्रिंग)=0; वर्चुअल स्ट्रिंग recv()=0;}; कक्षा इको: सार्वजनिक प्रोटोकॉल {स्ट्रिंग अंतिम; सार्वजनिक:शून्य भेजें(स्ट्रिंग s)ओवरराइड{अंतिम=s;} स्ट्रिंग recv()ओवरराइड{अंतिम वापसी;}}; इको ई; ई.भेजें('हैलो'); अदालत
hello नमस्ते
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) recv returns last sent. Output: hello.
व्याख्या (हिन्दी) recv रिटर्न अंतिम बार भेजा गया। आउटपुट: नमस्ते.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 97

EN + हिं
GB What is the output: template auto pipeline(T x){return x;} template auto pipeline(T x,F f,Fs...fs){return pipeline(f(x),fs...);} cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो पाइपलाइन(T x){रिटर्न x;} टेम्पलेट ऑटो पाइपलाइन(T x,F f,Fs...fs){रिटर्न पाइपलाइन(f(x),fs...);} cout
169 169
100 100
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5*2=10; 10+3=13; 13^2=169. Output: 169.
व्याख्या (हिन्दी) 5*2=10; 10+3=13; 13^2=169. आउटपुट: 169.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 98

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

Question 99

EN + हिं
GB What is the output: class I{public:virtual void exec()=0; virtual ~I()=default;}; class Greet:public I{string n;public:Greet(string s):n(s){} void exec()override{cout<<"Hi "+n;}}; queue>q; q.push(make_unique("A")); q.push(make_unique("B")); while(!q.empty()){q.front()->exec();q.pop();}
IN आउटपुट क्या है: क्लास I{public:virtual void exec()=0; आभासी ~I()=डिफ़ॉल्ट;}; क्लास ग्रीट:पब्लिक I{स्ट्रिंग n;पब्लिक:ग्रीट(स्ट्रिंग s):n(s){} void exec()ओवरराइड{cout
Hi AHi B हाय एहाय बी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
Hi A Hi B हाय ए हाय बी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) FIFO: Hi A then Hi B. Output: Hi AHi B.
व्याख्या (हिन्दी) फीफो: हाय ए, फिर हाय बी। आउटपुट: हाय ए, हाय बी।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 100

EN + हिं
GB What is the output: template class Lazy2{mutable optionalcache; functionfn; public:Lazy2(functionf):fn(f){} T get()const{if(!cache)cache=fn();return *cache;}}; int c=0; Lazy2l([&c](){return ++c;}); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास Lazy2{म्यूटेबल ऑप्शनल कैश; functionfn; सार्वजनिक:Lazy2(functionf):fn(f){} T get()const{if(!cache)cache=fn();return *cache;}}; पूर्णांक सी=0; Lazy2l([&c](){रिटर्न++c;}); अदालत
111 111
121 121
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First get(): c=1,cache=1. Second: from cache=1. c=1. Output: 111.
व्याख्या (हिन्दी) सबसे पहले प्राप्त करें(): c=1,cache=1. दूसरा: कैश से=1. सी=1. आउटपुट: 111.
🎯 Exam Perspective
OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 101

EN + हिं
GB What is the output: template auto transform_pair(pairp,functionf,functiong){return make_pair(f(p.first),g(p.second));} auto r=transform_pair({5,"hi"},[](int x){return x*2;},[](string s){return s+"!";}); cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो ट्रांसफॉर्म_पेयर(पेयरप,फंक्शनएफ,फंक्शनजी){रिटर्न मेक_पेयर(एफ(पी.फर्स्ट),जी(पी.सेकेंड));} ऑटो आर=ट्रांसफॉर्म_पेयर({5,"हाय"},[](इंट एक्स){रिटर्न x*2;},[](स्ट्रिंग एस){रिटर्न एस+"!";}); अदालत
10hi! 10हाय!
5hi 5हाय
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5*2=10; "hi"+"!"="hi!". Output: 10hi!.
व्याख्या (हिन्दी) 5*2=10; "हाय"+"!"="हाय!"। आउटपुट: 10हाय!
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।