OOP Using C++ — MCQ Practice

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

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

Question 16

EN + हिं
GB What is the output: try{throw 1;}catch(long l){cout<<'L';}catch(int i){cout<<'I';}
IN आउटपुट क्या है: प्रयास करें {थ्रो 1;} कैच (लॉन्ग एल) {काउट
L एल
I मैं
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) No implicit conversion in exception catching; int matches catch(int) not catch(long). Output: I.
व्याख्या (हिन्दी) अपवाद पकड़ने में कोई अंतर्निहित रूपांतरण नहीं; int कैच (int) से मेल खाता है, कैच (लंबा) से नहीं। आउटपुट: मैं.
🎯 Exam Perspective
OOP Using C++ ("Exception Handling" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 17

EN + हिं
GB What is 'RETHROW' in C++?
IN C++ में 'रेथ्रो' क्या है?
throw; inside catch block re-throws current exception फेंक; कैच ब्लॉक के अंदर वर्तमान अपवाद को फिर से फेंकता है
throw exception from catch कैच से अपवाद फेंकें
Copy of exception thrown अपवाद की प्रतिलिपि फेंकी गई
New exception from catch पकड़ से नया अपवाद
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) throw; (no argument) inside a catch handler rethrows the current exception preserving its type.
व्याख्या (हिन्दी) फेंक; (कोई तर्क नहीं) कैच हैंडलर के अंदर वर्तमान अपवाद को उसके प्रकार को संरक्षित करते हुए पुनर्स्थापित करता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Exception Handling" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 18

EN + हिं
GB What is the output: struct Base{virtual ~Base()=default;}; struct Der:Base{}; try{throw Der();}catch(Base& b){cout<<'B';}catch(Der& d){cout<<'D';}
IN आउटपुट क्या है: struct Base{virtual ~Base()=default;}; संरचना डेर:बेस{}; प्रयास करें{थ्रो डेर();}कैच(बेस& बी){काउट
B बी
D डी
Compile error संकलन त्रुटि
BD बी.डी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Catch handlers tried in order. Der is-a Base, so catch(Base&) matches first. Output: B. (Put more specific catch first!)
व्याख्या (हिन्दी) कैच संचालकों ने क्रम में प्रयास किया। डेर एक बेस है, इसलिए कैच(बेस&) पहले मेल खाता है। आउटपुट: बी. (पहले अधिक विशिष्ट कैच डालें!)
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Exception Handling" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 19

EN + हिं
GB What is 'std::terminate' called in situations besides uncaught exception?
IN अज्ञात अपवाद के अलावा अन्य स्थितियों में 'std::terminet' को क्या कहा जाता है?
noexcept function throws, or exception in destructor during unwinding अनवाइंडिंग के दौरान नोएक्सेप्ट फ़ंक्शन थ्रो, या डिस्ट्रक्टर में अपवाद
Out of memory स्मृति से बाहर
Stack overflow स्टैक ओवरफ़्लो
Null pointer dereference शून्य सूचक डीरेफ़रेंस
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::terminate is called: uncaught exception, noexcept violation, exception during stack unwinding, bad terminate() etc.
व्याख्या (हिन्दी) एसटीडी::टर्मिनेट को कहा जाता है: अनकहा अपवाद, नोएक्सेप्ट उल्लंघन, स्टैक अनवाइंडिंग के दौरान अपवाद, खराब टर्मिनेट() आदि।
🎯 Exam Perspective
OOP Using C++ ("Exception Handling" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 20

EN + हिं
GB What is the output: try{throw;}catch(...){cout<<'X';}
IN आउटपुट क्या है: प्रयास करें {फेंकें;} पकड़ें (...) {काउट करें
X एक्स
std::terminate एसटीडी::समाप्त
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Re-throw with no active exception calls std::terminate.
व्याख्या (हिन्दी) बिना किसी सक्रिय अपवाद के पुनः थ्रो करें कॉल std::समाप्त करें।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Exception Handling" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 21

EN + हिं
GB What is the output: try{try{throw 1;}catch(int i){throw i+1;}}catch(int i){cout<
IN आउटपुट क्या है: प्रयास करें {कोशिश करें 1 फेंकें;} पकड़ें (int i) {फेंकें i + 1;
2 2
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Inner catch catches 1, throws i+1=2. Outer catch catches 2. Output: 2.
व्याख्या (हिन्दी) इनर कैच कैच 1, थ्रो i+1=2. बाहरी कैच कैच 2. आउटपुट: 2.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Exception Handling" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 22

EN + हिं
GB What is 'function-try-block'?
IN 'फ़ंक्शन-ट्राई-ब्लॉक' क्या है?
Try-catch wrapping entire function including member initializer list सदस्य इनिशियलाइज़र सूची सहित संपूर्ण फ़ंक्शन को रैप करने का प्रयास करें
Exception in function body only केवल फ़ंक्शन बॉडी में अपवाद
A macro for try-catch प्रयास-पकड़ने के लिए एक मैक्रो
Template exception handling टेम्प्लेट अपवाद प्रबंधन
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Function-try-block: A()try:x(init()){}catch(...){} — catches exceptions in member initializer list.
व्याख्या (हिन्दी) फ़ंक्शन-ट्राई-ब्लॉक: A()try:x(init()){}catch(...){} - सदस्य इनिशियलाइज़र सूची में अपवादों को पकड़ता है।
🎯 Exam Perspective
OOP Using C++ ("Exception Handling" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 23

EN + हिं
GB What is the output: void f() noexcept(false){throw 1;} void g() noexcept{f();} try{g();}catch(...){cout<<'C';}
IN आउटपुट क्या है: void f() noexcept(false){throw 1;} void g() noexcept{f();} Try{g();}catch(...){cout
C सी
std::terminate एसटीडी::समाप्त
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) g() is noexcept; when f() throws, the exception escapes g(), triggering terminate().
व्याख्या (हिन्दी) g() कोई अपवाद नहीं है; जब f() फेंकता है, तो अपवाद g() से बच जाता है, जिससे समाप्ति() ट्रिगर हो जाती है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Exception Handling" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 24

EN + हिं
GB What is the output: try{throw std::runtime_error("fail");}catch(std::exception& e){cout<
IN आउटपुट क्या है: प्रयास करें{थ्रो std::runtime_error('fail');}catch(std::exception& e){cout
fail असफल
runtime_error रनटाइम त्रुटि
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::runtime_error inherits std::exception. what() returns the message "fail". Output: fail.
व्याख्या (हिन्दी) std::runtime_error को std::अपवाद विरासत में मिला है। क्या() संदेश "विफल" लौटाता है। आउटपुट: असफल.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Exception Handling" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 25

EN + हिं
GB What is 'exception neutral' code?
IN 'अपवाद तटस्थ' कोड क्या है?
Code that doesn't catch exceptions but allows them to propagate कोड जो अपवादों को नहीं पकड़ता बल्कि उन्हें प्रचारित करने की अनुमति देता है
Code with no exceptions possible बिना किसी अपवाद के कोड संभव है
noexcept everywhere हर जगह छोड़कर नहीं
Try-catch everywhere हर जगह पकड़ने की कोशिश करो
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Exception neutral code lets exceptions pass through transparently, maintaining strong safety guarantee.
व्याख्या (हिन्दी) अपवाद तटस्थ कोड मजबूत सुरक्षा गारंटी बनाए रखते हुए अपवादों को पारदर्शी रूप से पारित करने देता है।
🎯 Exam Perspective
OOP Using C++ ("Exception Handling" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 26

EN + हिं
GB What is the output: struct A{A(){throw 1;} ~A(){cout<<'D';}}; try{A a;}catch(int){cout<<'C';}
IN आउटपुट क्या है: struct A{A(){throw 1;} ~A(){cout
DC डीसी
CD सीडी
C सी
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Object not fully constructed; destructor NOT called. Only catch runs. Output: C.
व्याख्या (हिन्दी) वस्तु पूर्णतः निर्मित नहीं है; विध्वंसक को नहीं बुलाया गया। केवल रन पकड़ो. आउटपुट: सी.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Exception Handling" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 27

EN + हिं
GB What is 'nested exception' in C++?
IN C++ में 'नेस्टेड अपवाद' क्या है?
std::nested_exception stores current exception while throwing another std::nested_exception किसी अन्य को फेंकते समय वर्तमान अपवाद को संग्रहीत करता है
Exception inside destructor विध्वंसक के अंदर अपवाद
Recursive exception पुनरावर्ती अपवाद
Exception chain अपवाद शृंखला
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::nested_exception and std::throw_with_nested() allow chaining exceptions (like Java's cause).
व्याख्या (हिन्दी) std::nested_exception और std::throw_with_nested() चेनिंग अपवादों की अनुमति देते हैं (जैसे जावा का कारण)।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Exception Handling" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 28

EN + हिं
GB What is the output: try{vector v; v.at(5);}catch(out_of_range& e){cout<<'O';}catch(...){cout<<'X';}
IN आउटपुट क्या है: प्रयास करें {वेक्टर v; v.at(5);}catch(out_of_range& e){cout
O हे
X एक्स
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) vector::at() throws std::out_of_range for invalid index. catch(out_of_range) matches. Output: O.
व्याख्या (हिन्दी) वेक्टर::at() अमान्य अनुक्रमणिका के लिए std::out_of_range फेंकता है। कैच(आउट_ऑफ_रेंज) मैच। आउटपुट: ओ.
🎯 Exam Perspective
OOP Using C++ ("Exception Handling" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 29

EN + हिं
GB What is the output: int x=0; try{x=1; throw 1; x=2;}catch(int){x=3;} cout<
IN आउटपुट क्या है: int x=0; प्रयास करें{x=1; फेंको 1; x=2;}catch(int){x=3;} cout
3 3
1 1
2 2
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=1, throw 1 skips x=2, catch sets x=3. Output: 3.
व्याख्या (हिन्दी) x=1, 1 स्किप x=2 फेंकें, कैच सेट x=3। आउटपुट: 3.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Exception Handling" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 30

EN + हिं
GB What is the output: try{throw 1;}catch(int i){cout<
IN आउटपुट क्या है: Try{throw 1;}catch(int i){cout
1 1
2 2
12 12
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multiple handlers for the same type after the first is unreachable; some compilers warn/error. This is a compile error.
व्याख्या (हिन्दी) पहले के पहुंच से बाहर होने के बाद एक ही प्रकार के लिए एकाधिक हैंडलर; कुछ कंपाइलर्स चेतावनी/त्रुटि देते हैं। यह एक संकलन त्रुटि है.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Exception Handling" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।