OOP Using C++ — MCQ Practice

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

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

Question 1

EN + हिं
GB What is the output: for(int i=0;i<5;i++) if(i==3) continue; cout<
IN आउटपुट क्या है: for(int i=0;i
01245 01245
01234 01234
Compile error संकलन त्रुटि
0124 0124
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i is declared inside for; it's not accessible after the loop. Compile error.
व्याख्या (हिन्दी) i के लिए अंदर घोषित किया गया है; यह लूप के बाद पहुंच योग्य नहीं है। संकलन त्रुटि.
🎯 Exam Perspective
OOP Using C++ ("Control Statements" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 2

EN + हिं
GB What is the output: int x=10; switch(x){case 10: cout<<'A'; case 20: cout<<'B'; default: cout<<'C';}
IN आउटपुट क्या है: int x=10; स्विच(x){केस 10: कॉउट
A
ABC एबीसी
AB अब
AC ए.सी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Without break statements, execution falls through all subsequent cases after matching case 10. Output: ABC.
व्याख्या (हिन्दी) ब्रेक स्टेटमेंट के बिना, केस 10 के मिलान के बाद सभी बाद के मामलों में निष्पादन गिर जाता है। आउटपुट: एबीसी।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Control Statements" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 3

EN + हिं
GB What does 'goto' do in C++?
IN C++ में 'goto' क्या करता है?
Jumps to a labeled statement एक लेबल किए गए कथन पर चला जाता है
Is removed in C++11 C++11 में हटा दिया गया है
Only works inside loops केवल लूप के अंदर काम करता है
Causes undefined behavior अपरिभाषित व्यवहार का कारण बनता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) goto transfers control to a named label within the same function. It is legal but considered poor style.
व्याख्या (हिन्दी) goto transfers control to a named label within the same function. यह कानूनी है लेकिन ख़राब शैली मानी जाती है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Control Statements" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 4

EN + हिं
GB What is the output: int i=0; do{ cout<
IN आउटपुट क्या है: int i=0; करो {मुफ़्त करो
Nothing कुछ नहीं
01 01
Infinite loop अनंत लूप
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) do-while executes body at least once. Prints i=0, then i becomes 1, condition 1<0 is false, loop exits.
व्याख्या (हिन्दी) डू-व्हाइल बॉडी को कम से कम एक बार निष्पादित करता है। i=0 प्रिंट करता है, फिर i 1 हो जाता है, शर्त 1
🎯 Exam Perspective
OOP Using C++ ("Control Statements" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 5

EN + हिं
GB What is the output: for(;;) { static int x=0; cout<2) break; }
IN आउटपुट क्या है: for(;;) {static int x=0; अदालत
012 012
123 123
Infinite loop अनंत लूप
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Static x persists; loop: print 0, x=1; print 1, x=2; print 2, x=3, 3>2 break. Output: 012.
व्याख्या (हिन्दी) स्थैतिक x कायम रहता है; लूप: प्रिंट 0, x=1; प्रिंट 1, x=2; प्रिंट 2, x=3, 3>2 ​​ब्रेक। आउटपुट: 012.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Control Statements" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 6

EN + हिं
GB What is the output: int x=5; if(x>3) if(x>4) cout<<'A'; else cout<<'B';
IN आउटपुट क्या है: int x=5; if(x>3) if(x>4) cout
A
B बी
AB अब
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Dangling else: else binds to nearest if. x>4 is true so 'A' is printed.
व्याख्या (हिन्दी) डैंगलिंग अन्य: अन्यथा निकटतम यदि से जुड़ता है। x>4 सत्य है इसलिए 'ए' मुद्रित है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Control Statements" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 7

EN + हिं
GB What is the output: for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(i==j) goto done; done: cout<<'X';
IN आउटपुट क्या है: for(int i=0;i
X एक्स
XXX XXX
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) When i==0 and j==0, goto jumps to done label, printing X once.
व्याख्या (हिन्दी) जब i==0 और j==0, गोटो पूर्ण लेबल पर चला जाता है, X को एक बार प्रिंट करता है।
🎯 Exam Perspective
OOP Using C++ ("Control Statements" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 8

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
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Control Statements" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 9

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
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Control Statements" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 10

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++ ("Control Statements" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 11

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++ ("Control Statements" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 12

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
यह प्रश्न OOP Using C++ ("Control Statements" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 13

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
OOP Using C++ ("Control Statements" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 14

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
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Control Statements" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 15

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
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Control Statements" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।