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
61
EN + हिं
GB What is the output: int x=0; for(int i=1;i<=5;i++) x+=(i%2?i:-i); cout<
IN आउटपुट क्या है: int x=0; for(int i=1;i
A
3 3
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1-2+3-4+5=3. Output: 3.
व्याख्या (हिन्दी) 1-2+3-4+5=3. आउटपुट: 3.
62
EN + हिं
GB What is the output: for(int i=0;i<5;i++) {if(i==2) goto skip; cout<
IN आउटपुट क्या है: for(int i=0;i
A
01 01
B
0123 0123
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:print 0; i=1:print 1; i=2: goto skip exits loop. Output: 01.
व्याख्या (हिन्दी) मैं=0:प्रिंट 0; मैं=1:प्रिंट 1; i=2: गोटो स्किप एग्जिट लूप। आउटपुट: 01.
63
EN + हिं
GB What is the output: int x=5; cout<<(x==5?x==4?'A':'B':'C');
IN आउटपुट क्या है: int x=5; अदालत
A
B बी
B
A
C
C सी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x==5=true; inner x==4=false; 'B'. Output: B.
व्याख्या (हिन्दी) x==5=सत्य; आंतरिक x==4=गलत; 'बी'। आउटपुट: बी.
64
EN + हिं
GB What is the output: for(int i=1;i<=4;i++) for(int j=1;j<=4;j++) if(i*j==6) cout<
IN आउटपुट क्या है: for(int i=1;i
A
2316 23 2316 23
B
2 3 2 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (2,3) and (3,2). Output: 2332.
व्याख्या (हिन्दी) (2,3) और (3,2)। आउटपुट: 2332.
65
EN + हिं
GB What is the output: int x=7; if(x%2){if(x%3) cout<<'B'; else cout<<'C';} else cout<<'D';
IN आउटपुट क्या है: int x=7; if(x%2){if(x%3) cout
A
B बी
B
C सी
C
D डी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7%2=1(truthy),7%3=1(truthy): 'B'. Output: B.
व्याख्या (हिन्दी) 7%2=1(सत्य),7%3=1(सत्य): 'बी'। आउटपुट: बी.
66
EN + हिं
GB What is the output: for(int i=0;i<5;i++) cout<<(1<
IN आउटपुट क्या है: for(int i=0;i
A
12 4 8 16 12 4 8 16
B
124816 124816
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,2,4,8,16 concatenated: 124816. Output: 124816.
व्याख्या (हिन्दी) 1,2,4,8,16 संयोजित: 124816। आउटपुट: 124816।
67
EN + हिं
GB What is the output: int x=5; switch(x){ case 5: { int y=10; cout<
IN आउटपुट क्या है: int x=5; स्विच(x){ केस 5: { int y=10; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) y declared in block; cout<
व्याख्या (हिन्दी) y ब्लॉक में घोषित; अदालत
68
EN + हिं
GB What is the output: int x=0; for(int i=0;i<4;i++) x|=1<
IN आउटपुट क्या है: int x=0; for(int i=0;i
A
15 15
B
4 4
C
8 8
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1|2|4|8=15. Output: 15.
व्याख्या (हिन्दी) 1|2|4|8=15. आउटपुट: 15.
69
EN + हिं
GB What is the output: for(int i=0;i<3;i++) { int x=i*i; cout<
IN आउटपुट क्या है: for(int i=0;i
A
014 014
B
149 149
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0,1,4. Output: 014.
व्याख्या (हिन्दी) 0,1,4. आउटपुट: 014.
70
EN + हिं
GB What is the output: for(int i=100;i>0;i/=10) cout<
IN आउटपुट क्या है: for(int i=100;i>0;i/=10) cout
A
001 001
B
100 100
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=100:0; i=10:0; i=1:1; i=0>0 false. Output: 001.
व्याख्या (हिन्दी) मैं=100:0; मैं=10:0; मैं=1:1; i=0>0 असत्य। आउटपुट: 001.
71
EN + हिं
GB What is the output: int n=0; for(int i=2;i<20;i++){bool ok=true;for(int j=2;j*j<=i;j++) if(i%j==0){ok=false;break;} if(ok)n++;} cout<
IN आउटपुट क्या है: int n=0; for(int i=2;i
A
8 8
B
7 7
C
9 9
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Primes < 20: 2,3,5,7,11,13,17,19 = 8. Output: 8.
व्याख्या (हिन्दी) अभाज्य <20: 2,3,5,7,11,13,17,19 = 8. आउटपुट: 8.
72
EN + हिं
GB 'What is the output: int x=10; while(x>0){if(x%4==0) {cout<
IN 'आउटपुट क्या है: int x=10; while(x>0){if(x%4==0) {cout
A
2%3=2 2%3=2
B
4%3=1. Output: 01201.', 0, '2026-05-25', '2026-05-25'), (1, 6, 74, 4, 4, 'What is the output: int g=0; for(int i=1;i<=5;i++) for(int j=1;j<=5;j++) if(__gcd(i,j)==1) g++; cout<<g;', 'Count coprime pairs 1-5?', 'Compile error', 'Compile error', '16', '16', '25', '25', 'Undefined', 'Undefined', NULL, 'option_b', 'Euler\'s totient: count pairs (i,j) in 1..5x1..5 where gcd=1. Tedious but ~16 pairs. Output: 16.' 4%3=1. आउटपुट: 01201.', 0, '2026-05-25', '2026-05-25'), (1, 6, 74, 4, 4, 'आउटपुट क्या है: int g=0; for(int i=1;i
C
2026-05-25 2026-05-25
✅ Correct Answer:
73
EN + हिं
GB What is the output: for(int i=0;i<5;i++) cout<
IN आउटपुट क्या है: for(int i=0;i
A
01201 01201
B
01234 01234
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0%3=0,1%3=1,2%3=2,3%3=0,4%3=1. Output: 01201.
व्याख्या (हिन्दी) 0%3=0,1%3=1,2%3=2,3%3=0,4%3=1. आउटपुट: 01201.
74
EN + हिं
GB What is the output: int g=0; for(int i=1;i<=5;i++) for(int j=1;j<=5;j++) if(__gcd(i,j)==1) g++; cout<
IN आउटपुट क्या है: int g=0; for(int i=1;i
A
Compile error संकलन त्रुटि
B
16 16
C
25 25
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Euler's totient: count pairs (i,j) in 1..5x1..5 where gcd=1. Tedious but ~16 pairs. Output: 16.
व्याख्या (हिन्दी) यूलर का टोटिएंट: 1..5x1..5 में जोड़े (i,j) की गणना करें जहां gcd=1। थकाऊ लेकिन ~16 जोड़े। आउटपुट: 16.
75
EN + हिं
GB What is the output: int x=1; for(int i=0;i<8;i++){if(x>100)break; x*=2;} cout<
IN आउटपुट क्या है: int x=1; for(int i=0;i100)ब्रेक; x*=2;} कोउट
A
128 128
B
64 64
C
256 256
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,2,4,8,16,32,64,128. 128>100: break after x=128. Output: 128.
व्याख्या (हिन्दी) 1,2,4,8,16,32,64,128. 128>100: x=128 के बाद ब्रेक। आउटपुट: 128.
61–75 of 133