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
121
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) cout<<(i%2?"*":"_");
IN आउटपुट क्या है: for(int i=1;i
A
*_*_* *_*_*
B
_*_*_ _*_*_
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1:*,2:_,3:*,4:_,5:*. Output: *_*_*.
व्याख्या (हिन्दी) 1:*,2:_,3:*,4:_,5:*. आउटपुट: *_*_*.
122
EN + हिं
GB What is the output: int x=5,y=0; while(x>0){y=y*10+x%10;x/=10;} cout<
IN आउटपुट क्या है: int x=5,y=0; while(x>0){y=y*10+x%10;x/=10;} cout
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 reversed is 5. Output: 5.
व्याख्या (हिन्दी) 5 का उलटा 5 है। आउटपुट: 5.
123
EN + हिं
GB 'What is the output: for(int i=0;i<3;i++) {for(int j=2;j>=0;j (1, 6, 74, 4, 4, 'What is the output: int x=0; for(int i=0;i<10;i+=3) x++; cout<
IN 'आउटपुट क्या है: for(int i=0;i=0;j (1, 6, 74, 4, 4, 'आउटपुट क्या है: int x=0; for(int i=0;i
A
6 6
B
10 10
C
20 20
D
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2
व्याख्या (हिन्दी) 2
124
EN + हिं
GB What is the output: int x=0; for(int i=0;i<10;i+=3) x++; cout<
IN आउटपुट क्या है: int x=0; for(int i=0;i
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0,3,6,9: 4 iterations. Output: 4.
व्याख्या (हिन्दी) i=0,3,6,9: 4 पुनरावृत्तियाँ। आउटपुट: 4.
125
EN + हिं
GB What is the output: int x=255; while(x>0){cout<<(x&1); x>>=1;}
IN आउटपुट क्या है: int x=255; जबकि(x>0){cout=1;}
A
11111111 11111111
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Reversed औंधा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 255=all 1s in 8 bits; printed LSB first: 11111111. Output: 11111111.
व्याख्या (हिन्दी) 255=8 बिट्स में सभी 1; मुद्रित एलएसबी पहले: 111111111। आउटपुट: 111111111।
126
EN + हिं
GB What is the output: int s=0; for(int i=1;i<=100;i++) {if(i%5==0) s+=i; if(s>50) break;} cout<
IN आउटपुट क्या है: int s=0; for(int i=1;i50) breaking;} cout
A
55 55
B
50 50
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5+10+15+20=50; 50>50 false; +25=75... wait: s=5,10,15,20,25=75>50 break after 25? No: check after adding. s=5:!>50;s=15:!>50;s=30:!>50;s=50:!>50;s=75:>50 break. Output: 75.
व्याख्या (हिन्दी) 5+10+15+20=50; 50>50 झूठा; +25=75... प्रतीक्षा करें: s=5,10,15,20,25=75>25 के बाद 50 ब्रेक? नहीं: जोड़ने के बाद जांचें. s=5:!>50;s=15:!>50;s=30:!>50;s=50:!>50;s=75:>50 ब्रेक। आउटपुट: 75.
127
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) cout<
IN आउटपुट क्या है: for(int i=1;i
A
1, 2, 3, 4, 5 1, 2, 3, 4, 5
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Output: 1, 2, 3, 4, 5.
व्याख्या (हिन्दी) आउटपुट: 1, 2, 3, 4, 5.
128
EN + हिं
GB What is the output: int x=5; if(x>0&&x<10) cout<<'M'; else if(x>=10) cout<<'H'; else cout<<'L';
IN आउटपुट क्या है: int x=5; यदि(x>0&&x
A
M एम
B
H एच
C
L एल
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0<5<10: M. Output: M.
व्याख्या (हिन्दी) 0
129
EN + हिं
GB What is the output: for(int i=0;i<5;i++) {if(i<2) continue; if(i>3) break; cout<
IN आउटपुट क्या है: for(int i=0;i
A
23 23
B
234 234
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0,1:skip; i=2:print; i=3:print; i=4:break. Output: 23.
व्याख्या (हिन्दी) मैं=0,1:छोड़ें; मैं=2:प्रिंट; मैं=3:प्रिंट; मैं=4:ब्रेक। आउटपुट: 23.
130
EN + हिं
GB What is the output: int x=2,count=0; while(x<=100){x*=x; count++;} cout<
IN आउटपुट क्या है: int x=2,count=0; जबकि(x
A
2 2
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2->4->16->256(>100). count=3? x=2:<=100:x=4,c=1; x=4:<=100:x=16,c=2; x=16:<=100:x=256,c=3; 256>100:stop. Output: 3.
व्याख्या (हिन्दी) 2->4->16->256(>100). गिनती=3? एक्स=2:
131
EN + हिं
GB What is the output: int n=12,d=0; while(n>0){d++;n/=10;} cout<
IN आउटपुट क्या है: int n=12,d=0; while(n>0){d++;n/=10;} कोउट
A
2 2
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 12/10=1,d=1; 1/10=0,d=2; n=0 stop. Output: 2.
व्याख्या (हिन्दी) 12/10=1,डी=1; 1/10=0,डी=2; n=0 रुकें. आउटपुट: 2.
132
EN + हिं
GB What is the output: int x=100,n=0; do{x=x/2+x%2; n++;}while(x>1); cout<
IN आउटपुट क्या है: int x=100,n=0; करो{x=x/2+x%2; n++;}जबकि(x>1); अदालत
A
71 71
B
61 61
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 100->50->25->13->7->4->2->1. Steps: 7. Output: 71.
व्याख्या (हिन्दी) 100->50->25->13->7->4->2->1. चरण: 7. आउटपुट: 71.
133
EN + हिं
GB What is the output: for(int i=1;i<6;i++) cout<<(i==3?string(3,'*'):to_string(i));
IN आउटपुट क्या है: for(int i=1;i
A
12***45 12***45
B
123456 123456
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,2,***,4,5. Output: 12***45.
व्याख्या (हिन्दी) 1,2,***,4,5. आउटपुट: 12***45.
121–133 of 133