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
1231
EN + हिं
GB What is the output: int x=1; switch(x){default: cout<<'D'; case 1: cout<<'A'; break; case 2: cout<<'B';}
IN आउटपुट क्या है: int x=1; स्विच(x){डिफ़ॉल्ट: कॉउट
A
DA डीए
B
A
C
D डी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=1 matches case 1 (cases checked in order but match is by value): A then break. Output: A.
व्याख्या (हिन्दी) x=1 केस 1 से मेल खाता है (मामलों को क्रम में जांचा गया है लेकिन मिलान मूल्य के अनुसार है): ए फिर ब्रेक। आउटपुट: ए.
1232
EN + हिं
GB What is the output: for(int i=1;i<10;i++) if(i%2==0) if(i%3==0) cout<
IN आउटपुट क्या है: for(int i=1;i
A
6 6
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6: even and div by 3. Output: 6.
व्याख्या (हिन्दी) 6: सम और विभाजन 3 से। आउटपुट: 6।
1233
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.
1234
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.
1235
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; शर्त मैं
1236
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.
1237
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
1238
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.
1239
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.
1240
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. आउटपुट: एबीसीएबी।
1241
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.
1242
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=सत्य। आउटपुट: टी.
1243
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.
1244
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.
1245
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: टी. आउटपुट: टी.
1231–1245 of 1915