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
91
EN + हिं
GB What is the output: int x=0; for(int i=0;i<5;i++) x=x>i?x:i; cout<
IN आउटपुट क्या है: int x=0; for(int i=0;ii?x:i; cout
A
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x tracks max: 0,1,2,3,4. Final x=4. Output: 4.
व्याख्या (हिन्दी) x ट्रैक अधिकतम: 0,1,2,3,4. अंतिम x=4. आउटपुट: 4.
92
EN + हिं
GB What is the output: int x=5; while(x>0) {cout<>=1;}
IN आउटपुट क्या है: int x=5; जबकि(x>0) {cout=1;}
A
5 2 1 5 2 1
B
531 531
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5,5>>1=2,2>>1=1,1>>1=0. Prints 5,2,1. Output: 521.
व्याख्या (हिन्दी) 5,5>>1=2,2>>1=1,1>>1=0. प्रिंट 5,2,1. आउटपुट: 521.
93
EN + हिं
GB What is the output: for(int i=0,s=0;i<5;s+=i,i++) cout<
IN आउटपुट क्या है: for(int i=0,s=0;i
A
0 1 3 6 10 0 1 3 6 10
B
01 3610 01 3610
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) s starts 0; each iteration: print s first, then s+=i,i++. i=0:print 0,s=0; i=1:print 0,s=1;... wait: for init: i=0,s=0; cond i<5; body: cout<
व्याख्या (हिन्दी) s प्रारंभ 0; प्रत्येक पुनरावृत्ति: पहले s प्रिंट करें, फिर s+=i,i++। i=0:प्रिंट 0,s=0; i=1:प्रिंट 0,s=1;... प्रतीक्षा करें: init के लिए: i=0,s=0; शर्त मैं
94
EN + हिं
GB What is the output: int x=2; do{x*=x;}while(x<1000); cout<
IN आउटपुट क्या है: int x=2; करो{x*=x;}जबकि(x
A
65536 65536
B
256 256
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2->4->16->256->65536. 256<1000: continue. 65536>=1000: stop. Output: 65536.
व्याख्या (हिन्दी) 2->4->16->256->65536. 256=1000: रुकें। आउटपुट: 65536.
95
EN + हिं
GB What is the output: for(int i=0;i<5;i++) {if(i==2) {i+=2; continue;} cout<
IN आउटपुट क्या है: for(int i=0;i
A
01 01
B
014 014
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:print 0;i=1:print 1;i=2:i=4,continue;i=5:loop ends. Wait: i=2,i+=2=4,continue;then increment i++=5,condition 5<5 false. Output: 014. Let me recheck: i=2:i+=2=4;continue: skip cout;then for-increment:i++=5. 5<5 false. Output: 01.
व्याख्या (हिन्दी) i=0:प्रिंट 0;i=1:प्रिंट 1;i=2:i=4,जारी रखें;i=5:लूप समाप्त होता है। प्रतीक्षा करें: i=2,i+=2=4, जारी रखें; फिर वृद्धि i++=5, शर्त 5
96
EN + हिं
GB What is the output: for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(i==1&&j==1) {cout<
IN आउटपुट क्या है: for(int i=0;i
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=1,j=1: i*j=1, print 1, goto exit. Output: 1.
व्याख्या (हिन्दी) i=1,j=1: i*j=1, प्रिंट 1, बाहर निकलें। आउटपुट: 1.
97
EN + हिं
GB What is the output: int x=0; for(int i=1;i<=5;i++) for(int j=1;j<=5;j++) if(i==j) x++; cout<
IN आउटपुट क्या है: int x=0; for(int i=1;i
A
5 5
B
25 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (1,1),(2,2),(3,3),(4,4),(5,5): 5 pairs. Output: 5.
व्याख्या (हिन्दी) (1,1),(2,2),(3,3),(4,4),(5,5): 5 जोड़े। आउटपुट: 5.
98
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) cout<<(i%3==1?'A':i%3==2?'B':'C');
IN आउटपुट क्या है: for(int i=1;i
A
ABCAB एबीसीएबी
B
ABCBA एबीसीबीए
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=1:1%3=1:A;i=2:2%3=2:B;i=3:0:C;i=4:1:A;i=5:2:B. Output: ABCAB.
व्याख्या (हिन्दी) i=1:1%3=1:A;i=2:2%3=2:B;i=3:0:C;i=4:1:A;i=5:2:B. आउटपुट: एबीसीएबी।
99
EN + हिं
GB What is the output: int s=0; for(int i=1;i<=10;i+=2) s+=i; cout<
IN आउटपुट क्या है: int s=0; for(int i=1;i
A
25 25
B
30 30
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+3+5+7+9=25. Output: 25.
व्याख्या (हिन्दी) 1+3+5+7+9=25. आउटपुट: 25.
100
EN + हिं
GB What is the output: if constexpr(2+2==4) cout<<'T'; else cout<<'F';
IN आउटपुट क्या है: यदि constexpr(2+2==4) cout
A
T टी
B
F एफ
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Compile-time: 2+2=4=true. Output: T.
व्याख्या (हिन्दी) संकलन-समय: 2+2=4=सत्य। आउटपुट: टी.
101
EN + हिं
GB What is the output: int x=10; while(x>0) {x=(x%3==0)?x-3:x-1;} cout<
IN आउटपुट क्या है: int x=10; while(x>0) {x=(x%3==0)?x-3:x-1;} cout
B
-1 -1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10->9->6->3->0. Output: 0.
व्याख्या (हिन्दी) 10->9->6->3->0. आउटपुट: 0.
102
EN + हिं
GB What is the output: for(int i=0;i<10;i++) if((i%2==0)&&(i%3==0)) cout<
IN आउटपुट क्या है: for(int i=0;i
A
06 06
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0 and 6. Output: 06.
व्याख्या (हिन्दी) 0 और 6. आउटपुट: 06.
103
EN + हिं
GB What is the output: int x=5; switch(x%3){case 0:cout<<'Z';break; case 1:cout<<'O';break; case 2:cout<<'T';break;}
IN आउटपुट क्या है: int x=5; स्विच(x%3){केस 0:काउट
A
T टी
B
O हे
C
Z जेड
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%3=2: case 2: T. Output: T.
व्याख्या (हिन्दी) 5%3=2: केस 2: टी. आउटपुट: टी.
104
EN + हिं
GB 'What is the output: int n=5,f=1; for(int i=n;i>1;i (1, 6, 74, 4, 4, 'What is the output: for(int i=1;i<=5;i++) if(i==3) continue; else cout<
IN 'आउटपुट क्या है: int n=5,f=1; for(int i=n;i>1;i (1, 6, 74, 4, 4, 'आउटपुट क्या है: for(int i=1;i
A
i=4:4. Sum=1+2+4=7. Output: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: int f(int n){return n<=0?0:n+f(n-2);} cout<<f(5)+f(6);', 'f(5)=5+3+1=9 मैं=4:4. योग=1+2+4=7. आउटपुट: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'आउटपुट क्या है: int f(int n){return n
B
f(6)=12. 9+12=21. Output: 21.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'What is the output: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; cout<<f(4);', 'Recursive lambda (C++14 way without self)?', 'Compile error', 'Compile error', '24', '24', '4', '4', 'Undefined', 'Undefined', NULL, 'option_a', 'Lambda can\'t call itself by name (f is not captured). Compile error.' एफ(6)=12. 9+12=21. आउटपुट: 21.', 0, '2026-05-25', '2026-05-25'), (1, 6, 75, 5, 4, 'आउटपुट क्या है: auto f=[](int x)->int{return x>1?x*f(x-1):1;}; cout
C
2026-05-25 2026-05-25
✅ Correct Answer:
105
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) if(i==3) continue; else cout<
IN आउटपुट क्या है: for(int i=1;i
A
1245 1245
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=3: continue (skip else). Others: print. Output: 1245.
व्याख्या (हिन्दी) i=3: जारी रखें (अन्यथा छोड़ें)। Others: print. Output: 1245.
91–105 of 133