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 1861

EN + हिं
GB What is the output: try{try{throw string("inner");}catch(int){cout<<'I';}}catch(string& s){cout<
IN आउटपुट क्या है: प्रयास करें {कोशिश करें स्ट्रिंग फेंकें ("आंतरिक");} पकड़ें (int) {cout
inner आंतरिक
I मैं
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) string thrown; inner catches int (no match); outer catches string. Output: inner.
व्याख्या (हिन्दी) तार फेंका गया; आंतरिक कैच int (कोई मिलान नहीं); बाहरी कैच स्ट्रिंग. आउटपुट: आंतरिक.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1862

EN + हिं
GB What is the output: int x=5; try{if(x>0)throw x; cout<<'N';}catch(int i){cout<
IN आउटपुट क्या है: int x=5; प्रयास करें{if(x>0)फेंकें x; अदालत
10 10
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) throw 5; catch: 5*2=10. Output: 10.
व्याख्या (हिन्दी) फेंको 5; पकड़ें: 5*2=10. आउटपुट: 10.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1863

EN + हिं
GB What is the output: struct E{int code; string msg;}; try{throw E{42,"bad"};}catch(E& e){cout<
IN आउटपुट क्या है: struct E{int कोड; स्ट्रिंग संदेश;}; प्रयास करें{फेंकें E{42,"खराब"};}पकड़ें(E& e){मुकाबला करें
42bad 42खराब
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) e.code=42, e.msg=bad. Output: 42bad.
व्याख्या (हिन्दी) ई.कोड=42, ई.एमएसजी=खराब। आउटपुट: 42 ख़राब.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1864

EN + हिं
GB What is the output: auto divide=[](double a,double b)->expected{if(b==0)return unexpected("zero");return a/b;}; auto r=divide(10,2); cout<<(r?r.value():-1);
IN आउटपुट क्या है: ऑटो डिवाइड = [] (डबल ए, डबल बी) -> अपेक्षित {अगर (बी == 0) अप्रत्याशित वापसी ("शून्य"); रिटर्न ए/बी;}; ऑटो आर=विभाजन(10,2); अदालत
5 5
-1 -1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b!=0: r=5.0. Output: 5.
व्याख्या (हिन्दी) बी!=0: आर=5.0. आउटपुट: 5.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1865

EN + हिं
GB What is the output: try{throw overflow_error("big");}catch(overflow_error& e){cout<
IN आउटपुट क्या है: प्रयास करें {थ्रो ओवरफ्लो_एरर ("बिग");}कैच (ओवरफ्लो_एरर और ई) {काउट
big बड़ा
Compile error संकलन त्रुटि
Undefined अपरिभाषित
overflow_error अतिप्रवाह_त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) e.what()=big. Output: big.
व्याख्या (हिन्दी) ई.क्या()=बड़ा. आउटपुट: बड़ा.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1866

EN + हिं
GB What is the output: class Ex{public:Ex()=default; Ex(const Ex&){cout<<'C';}}; try{throw Ex();}catch(Ex e){cout<<'E';}
IN आउटपुट क्या है: class Ex{public:Ex()=default; पूर्व(const Ex&){cout
CE सीई
E
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Catch by value: copy ctor=C, then E. Output: CE.
व्याख्या (हिन्दी) मूल्य के आधार पर पकड़ें: ctor=C कॉपी करें, फिर E. आउटपुट: CE।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1867

EN + हिं
GB What is the output: int x=0; auto cleanup=[&x](){x=99;}; try{cleanup(); throw 1;}catch(int){cout<
IN आउटपुट क्या है: int x=0; ऑटो क्लीनअप=[&x](){x=99;}; प्रयास करें{सफाई(); फेंको 1;}पकड़ो(int){cout
99 99
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) cleanup sets x=99 before throw. catch: cout<<99. Output: 99.
व्याख्या (हिन्दी) फेंकने से पहले क्लीनअप सेट x=99। पकड़ो: कोउट
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1868

EN + हिं
GB What is the output: try{throw vector{1,2,3};}catch(vector& v){cout<
IN आउटपुट क्या है: प्रयास करें {वेक्टर फेंकें {1,2,3};} पकड़ें (वेक्टर और वी) {काउट करें
32 32
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=3, v[1]=2. Output: 32.
व्याख्या (हिन्दी) आकार=3, वी[1]=2. आउटपुट: 32.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1869

EN + हिं
GB What is the output: void f(int x){if(x<0)throw invalid_argument("neg"); cout<
IN आउटपुट क्या है: void f(int x){if(x
5neg 5नकारात्मक
5-1 5-1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=5; f(-1) throws. Output: 5neg.
व्याख्या (हिन्दी) एफ(5)=5; f(-1) फेंकता है। आउटपुट: 5 नकारात्मक.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1870

EN + हिं
GB What is the output: int x=0; try{x=1;throw;} catch(...){}
IN आउटपुट क्या है: int x=0; प्रयास करें{x=1;फेंकें;} पकड़ें(...){}
std::terminate एसटीडी::समाप्त
1 1
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) throw; with no active exception: std::terminate.
व्याख्या (हिन्दी) फेंक; बिना किसी सक्रिय अपवाद के: std::समाप्त।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1871

EN + हिं
GB What is the output: struct A{A(){cout<<'A';} ~A(){cout<<'a';}}; struct B{B(){cout<<'B';} ~B(){cout<<'b';}}; try{A a;B b;throw 1;}catch(int){cout<<'E';}
IN आउटपुट क्या है: struct A{A(){cout
ABbaE एबीबीएई
ABabE ए.बी.ए.बी.ई
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A,B ctors; throw: ~B(b),~A(a); catch: E. Output: ABbaE.
व्याख्या (हिन्दी) ए, बी ctors; फेंकें: ~बी(बी),~ए(ए); कैच: ई. आउटपुट: एबीबीएई।
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1872

EN + हिं
GB What is the output: auto f=[]()->pair{try{throw runtime_error("oops");return{true,""};}catch(exception&e){return{false,e.what()};}}; auto [ok,msg]=f(); cout<
IN आउटपुट क्या है: auto f=[]()->pair{try{throw runtime_error("उफ़");रिटर्न{true,""};}कैच(अपवाद&e){रिटर्न{false,e.what()};}}; ऑटो [ठीक है, संदेश]=f(); अदालत
0oops 0उफ़
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ok=0,msg=oops. Output: 0oops.
व्याख्या (हिन्दी) ठीक=0, संदेश=उफ़। आउटपुट: 0उफ़.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1873

EN + हिं
GB What is the output: int n=0; try{while(true){n++;if(n>3)throw n;}}catch(int x){cout<
IN आउटपुट क्या है: int n=0; प्रयास करें {जबकि (सही) {n ++; यदि (n> 3) फेंकें n;}} पकड़ें (int x) {cout
4 4
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n=4>3: throw 4. Output: 4.
व्याख्या (हिन्दी) n=4>3: थ्रो 4. आउटपुट: 4.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1874

EN + हिं
GB What is the output: try{throw 3.14;}catch(double d){cout<
IN आउटपुट क्या है: प्रयास करें {थ्रो 3.14;} कैच (डबल डी) {काउट
3.14 3.14
Compile error संकलन त्रुटि
Undefined अपरिभाषित
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Exact match: catch(double). Output: 3.14.
व्याख्या (हिन्दी) सटीक मिलान: पकड़ें(डबल)। आउटपुट: 3.14.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1875

EN + हिं
GB What is the output: class E{int c;public:E(int v):c(v){} int code(){return c;}}; try{throw E(7);}catch(E e){cout<
IN आउटपुट क्या है: क्लास E{int c;public:E(int v):c(v){} int कोड(){रिटर्न c;}}; प्रयास करें{फेंकें E(7);}पकड़ें(E e){cout
7 7
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) e.code()=7. Output: 7.
व्याख्या (हिन्दी) ई.कोड()=7. आउटपुट: 7.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।