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 106

EN + हिं
GB What is a 'range-based for loop' iteration over a raw array?
IN कच्चे सरणी पर 'लूप के लिए रेंज-आधारित' पुनरावृत्ति क्या है?
Iterates by pointer सूचक द्वारा पुनरावृत्त करता है
Iterates over each element प्रत्येक तत्व पर पुनरावृति करता है
Compile error संकलन त्रुटि
Only works with std containers केवल एसटीडी कंटेनरों के साथ काम करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Range-based for works on raw arrays as it knows their size at compile time: for(auto x: arr).
व्याख्या (हिन्दी) कच्चे सरणियों पर कार्यों के लिए रेंज-आधारित क्योंकि यह संकलन समय पर उनके आकार को जानता है: for(auto x: arr)।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 107

EN + हिं
GB What is the output: int x=5; while(x (1, 6, 74, 4, 4, 'What happens when break is used inside a nested loop?', 'What happens when break is used inside a nested loop?', 'Breaks out of all loops', 'Breaks out of innermost loop only', 'Compile error', 'Compile error', 'Undefined behavior', 'undefined behavior', NULL, 'option_b', 'break only exits the immediately enclosing loop or switch; not outer loops.', 0, '2026-05-25', '2026-05-25'), (1, 6, 74, 4, 4, 'What is the output: switch(2.5){ case 2: cout
IN What is the output: int x=5; while(x (1, 6, 74, 4, 4, 'What happens when break is used inside a nested loop?', 'Nested loop के अंदर break use करने पर क्या होता है?', 'Breaks out of all loops', 'सभी loops से बाहर निकलता है', 'Breaks out of innermost loop only', 'केवल innermost loop से बाहर निकलता है', 'Compile error', 'Compile error', 'Undefined behavior', 'undefined behavior', NULL, 'option_b', 'break only exits the immediately enclosing loop or switch; not outer loops.', 0, '2026-05-25', '2026-05-25'), (1, 6, 74, 4, 4, 'What is the output: switch(2.5){ case 2: cout<<'A'; break; default: cout<<'B'; }
A
B बी
Compile error संकलन त्रुटि
AB अब
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Switch condition must be integer type; double is not allowed. Compile error.
व्याख्या (हिन्दी) स्विच की स्थिति पूर्णांक प्रकार की होनी चाहिए; डबल की अनुमति नहीं है. संकलन त्रुटि.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 108

EN + हिं
GB What happens when break is used inside a nested loop?
IN क्या होता है जब नेस्टेड लूप के अंदर ब्रेक का उपयोग किया जाता है?
Breaks out of all loops सभी पाशों से टूट जाता है
Breaks out of innermost loop only अंतरतम पाश से ही टूटता है
Compile error संकलन त्रुटि
Undefined behavior अपरिभाषित व्यवहार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) break only exits the immediately enclosing loop or switch; not outer loops.
व्याख्या (हिन्दी) ब्रेक केवल तुरंत घेरने वाले लूप या स्विच से बाहर निकलता है; बाहरी लूप नहीं.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 109

EN + हिं
GB What is the output: switch(2.5){ case 2: cout<<'A'; break; default: cout<<'B'; }
IN आउटपुट क्या है: स्विच (2.5) {केस 2: कॉउट
A
B बी
Compile error संकलन त्रुटि
AB अब
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Switch condition must be integer type; double is not allowed. Compile error.
व्याख्या (हिन्दी) स्विच की स्थिति पूर्णांक प्रकार की होनी चाहिए; डबल की अनुमति नहीं है. संकलन त्रुटि.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 110

EN + हिं
GB What is the output: for(int i=1; i<=4; i*=2) cout<
IN आउटपुट क्या है: for(int i=1; i
1 2 4 1 2 4
1 2 3 4 1 2 3 4
2 4 2 4
1 4 1 4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=1 (print 1), i=2 (print 2), i=4 (print 4), i=8>4 stop. Output: 1 2 4.
व्याख्या (हिन्दी) i=1 (प्रिंट 1), i=2 (प्रिंट 2), i=4 (प्रिंट 4), i=8>4 स्टॉप। आउटपुट: 1 2 4.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 111

EN + हिं
GB What is the output: int x=0; for(;x<5;) cout<
IN आउटपुट क्या है: int x=0; के लिये(;x
01234 01234
12345 12345
Infinite loop अनंत लूप
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Empty init and increment; x++ post-increment prints then increments. Prints 0,1,2,3,4.
व्याख्या (हिन्दी) खाली init और वेतन वृद्धि; x++ वृद्धि के बाद प्रिंट करता है और फिर वृद्धि करता है। 0,1,2,3,4 प्रिंट करता है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 112

EN + हिं
GB What does 'fallthrough' attribute do in C++17?
IN C++17 में 'फ़ॉलथ्रू' विशेषता क्या करती है?
Forces compiler to fall through switch cases कंपाइलर को स्विच केस से गुजरने के लिए बाध्य करता है
Suppresses warning about intentional fallthrough जानबूझकर गिरावट के बारे में चेतावनी को दबा देता है
Makes switch case mandatory स्विच केस को अनिवार्य बनाता है
Removes need for break ब्रेक की आवश्यकता को दूर करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) [[fallthrough]] suppresses the -Wimplicit-fallthrough compiler warning, indicating the fallthrough is intentional.
व्याख्या (हिन्दी) [[फ़ॉलथ्रू]] -विम्प्लिसिट-फ़ॉलथ्रू कंपाइलर चेतावनी को दबा देता है, जो दर्शाता है कि फ़ॉलथ्रू जानबूझकर किया गया है।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 113

EN + हिं
GB What is the output: int i=5; for(i=0; i<3; i++) {} cout<
IN आउटपुट क्या है: int i=5; for(i=0; i
5 5
3 3
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i is declared outside for. After loop ends when i reaches 3, cout<
व्याख्या (हिन्दी) मैं के लिए बाहर घोषित किया गया है. लूप समाप्त होने के बाद जब मैं 3 तक पहुँचता हूँ, तो कॉउट
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 114

EN + हिं
GB What is the output: int x=1; if(x=0) cout<<'T'; else cout<<'F';
IN आउटपुट क्या है: int x=1; if(x=0) cout
T टी
F एफ
TF टी.एफ
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=0 assigns 0 (evaluates to 0 = false). else executes: prints F.
व्याख्या (हिन्दी) x=0 0 निर्दिष्ट करता है (0 = गलत का मूल्यांकन करता है)। अन्यथा निष्पादित करता है: एफ प्रिंट करता है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 115

EN + हिं
GB What is the output of an infinite while(true) loop with no break?
IN बिना किसी ब्रेक के अनंत समय (सही) लूप का आउटपुट क्या है?
Nothing कुछ नहीं
Program hangs indefinitely कार्यक्रम अनिश्चित काल के लिए रुका हुआ है
Undefined behavior अपरिभाषित व्यवहार
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) An infinite loop with no observable side effects is technically undefined behavior in C++11+, but in practice the program hangs.
व्याख्या (हिन्दी) बिना किसी प्रत्यक्ष दुष्प्रभाव वाला एक अनंत लूप C++11+ में तकनीकी रूप से अपरिभाषित व्यवहार है, लेकिन व्यवहार में प्रोग्राम हैंग हो जाता है।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 116

EN + हिं
GB What is the output: for(int i=0;i<5;i++) { if(i%2==0) continue; cout<
IN आउटपुट क्या है: for(int i=0;i
01234 01234
13 13
024 024
02 02
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) continue skips even numbers. Odd numbers 1 and 3 are printed.
व्याख्या (हिन्दी) जारी रखें सम संख्याओं को छोड़ देता है। विषम संख्याएँ 1 और 3 मुद्रित हैं।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 117

EN + हिं
GB What is the difference between while and do-while loops?
IN while और do-while लूप के बीच क्या अंतर है?
do-while executes body at least once डू-व्हाइल बॉडी को कम से कम एक बार निष्पादित करता है
while is faster जबकि तेज़ है
do-while requires break कार्य करते समय ब्रेक की आवश्यकता होती है
No difference कोई फर्क नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) do-while checks condition after executing body, so body always executes at least once even if condition is false initially.
व्याख्या (हिन्दी) डू-व्हाइल बॉडी को निष्पादित करने के बाद स्थिति की जांच करता है, इसलिए बॉडी हमेशा कम से कम एक बार निष्पादित होती है, भले ही शर्त शुरू में गलत हो।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 118

EN + हिं
GB What is the output: int x=3; switch(x) { case 1: case 2: case 3: cout<<'A'; break; default: cout<<'B'; }
IN आउटपुट क्या है: int x=3; स्विच(x) { केस 1: केस 2: केस 3: कॉउट
AB अब
A
B बी
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=3 matches case 3 (which falls through from case 1 and 2). Prints A, then breaks.
व्याख्या (हिन्दी) x=3 केस 3 से मेल खाता है (जो केस 1 और 2 से आता है)। ए प्रिंट करता है, फिर टूट जाता है।
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 119

EN + हिं
GB What is the output: int n=10; for(int i=2; i*i<=n; i++) if(n%i==0) { cout<<'C'; break; }
IN आउटपुट क्या है: int n=10; for(int i=2; i*i
C सी
CC सीसी
Nothing कुछ नहीं
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=2: 2*2=4<=10, 10%2==0, prints C and breaks.
व्याख्या (हिन्दी) मैं=2: 2*2=4
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 120

EN + हिं
GB What is the output: int x=0; while(x<3) { x++; if(x==2) break; } cout<
IN आउटपुट क्या है: int x=0; जबकि(x
3 3
2 2
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x goes 0->1, then 1->2, break at x==2. cout prints 2.
व्याख्या (हिन्दी) x 0->1 जाता है, फिर 1->2, x==2 पर टूटता है। कॉउट प्रिंट्स 2.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।