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
46
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) if(i!=3) cout<
IN आउटपुट क्या है: for(int i=1;i
A
1245 1245
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Skip i=3. Output: 1245.
व्याख्या (हिन्दी) i=3 छोड़ें. आउटपुट: 1245.
47
EN + हिं
GB What is the output: int x=5; switch(x){ case 1: case 2: case 3: case 4: case 5: cout<<'A';}
IN आउटपुट क्या है: int x=5; स्विच(x){ केस 1: केस 2: केस 3: केस 4: केस 5: कॉउट
A
A
B
AAAAA एएएएए
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Matches case 5 (via fallthrough from 1-4 which have no body). Prints A. Output: A.
व्याख्या (हिन्दी) केस 5 से मेल खाता है (1-4 से फॉलथ्रू के माध्यम से जिसमें कोई बॉडी नहीं है)। प्रिंट ए. आउटपुट: ए.
48
EN + हिं
GB What is the output: int s=0; for(int i=1;i<=100;i++) if(i%2!=0) s++; cout<
IN आउटपुट क्या है: int s=0; for(int i=1;i
A
50 50
B
100 100
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 50 odd numbers. Output: 50.
व्याख्या (हिन्दी) 50 विषम संख्याएँ. आउटपुट: 50.
49
EN + हिं
GB What is the output: for(int i=2;i<10;i++) if(i%2==0&&i%3==0) cout<
IN आउटपुट क्या है: for(int i=2;i
A
6 6
B
236 236
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Only 6. Output: 6.
व्याख्या (हिन्दी) केवल 6. आउटपुट: 6.
50
EN + हिं
GB What is the output: for(int i=0;i<5;i++) cout<<(i%2?'-':'+');
IN आउटपुट क्या है: for(int i=0;i
A
+-+-+ +-+-+
B
-+-+- -+-+-
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0:+, 1:-, 2:+, 3:-, 4:+. Output: +-+-+.
व्याख्या (हिन्दी) i=0:+, 1:-, 2:+, 3:-, 4:+. आउटपुट: +-+-+.
51
EN + हिं
GB What is the output: int x=100; int c=0; while(x>0){x/=2;c++;} cout<
IN आउटपुट क्या है: int x=100; पूर्णांक सी=0; while(x>0){x/=2;c++;} cout
A
7 7
B
6 6
C
8 8
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 100->50->25->12->6->3->1->0. 7 steps. Output: 7.
व्याख्या (हिन्दी) 100->50->25->12->6->3->1->0. 7 कदम. आउटपुट: 7.
52
EN + हिं
GB What is the output: for(auto c:'A','B','C') cout<
IN आउटपुट क्या है: for(auto c:'A','B','C') cout
A
Compile error संकलन त्रुटि
B
ABC एबीसी
C
A
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Comma expression; range-for on a char ('C') is invalid. Compile error.
व्याख्या (हिन्दी) अल्पविराम अभिव्यक्ति; चार पर रेंज-फॉर ('सी') अमान्य है। संकलन त्रुटि.
53
EN + हिं
GB What is the output: int x=0; while(++x<5) cout<
IN आउटपुट क्या है: int x=0; जबकि(++x
A
1234 1234
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=1<5:print 1; x=2<5:print 2; x=3<5:print 3; x=4<5:print 4; x=5<5 false. Output: 1234.
व्याख्या (हिन्दी) एक्स=1
54
EN + हिं
GB What is the output: int x=4; switch(x>>1){case 0:cout<<'Z';break;case 1:cout<<'O';break;case 2:cout<<'T';break;}
IN आउटपुट क्या है: int x=4; स्विच(x>>1){केस 0:काउट
A
T टी
B
O हे
C
Z जेड
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4>>1=2: case 2 prints T. Output: T.
व्याख्या (हिन्दी) 4>>1=2: केस 2 टी प्रिंट करता है। आउटपुट: टी।
55
EN + हिं
GB What is the output: int s=0; for(int i=1;i<=10;i++) s^=i; cout<
IN आउटपुट क्या है: int s=0; for(int i=1;i
A
11 11
C
55 55
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR of 1 to 10: 1^2^3^4^5^6^7^8^9^10=11. Output: 11.
व्याख्या (हिन्दी) 1 से 10 तक का XOR: 1^2^3^4^5^6^7^8^9^10=11. आउटपुट: 11.
56
EN + हिं
GB What is the output: int x=0; for(int i=0;i<4;i++) for(int j=0;j<4;j++) if(i+j==3) x++; cout<
IN आउटपुट क्या है: int x=0; for(int i=0;i
A
4 4
B
3 3
C
6 6
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (0,3),(1,2),(2,1),(3,0): 4 pairs. Output: 4.
व्याख्या (हिन्दी) (0,3),(1,2),(2,1),(3,0): 4 जोड़े। आउटपुट: 4.
57
EN + हिं
GB What is the output: for(int i=1;i<=5;i++) cout<<(i*(i+1)/2);
IN आउटपुट क्या है: for(int i=1;i
A
136 10 15 136 10 15
B
13610 15 13610 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,3,6,10,15 concatenated: 136 10 15. Without spaces: 136 1015. Output: 1361015.
व्याख्या (हिन्दी) 1,3,6,10,15 संयोजित: 136 10 15. रिक्त स्थान के बिना: 136 1015। आउटपुट: 1361015।
58
EN + हिं
GB What is the output: int n=6; bool isPrime=n>1; for(int i=2;i*i<=n;i++) if(n%i==0){isPrime=false;break;} cout<
IN आउटपुट क्या है: int n=6; बूल isPrime=n>1; for(int i=2;i*i
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6=2*3. Not prime. isPrime=false=0. Output: 0.
व्याख्या (हिन्दी) 6=2*3. प्रधान नहीं. isPrime=गलत=0. आउटपुट: 0.
59
EN + हिं
GB What is the output: for(int i=0,j=10;i<5;i++,j-=2) cout<
IN आउटपुट क्या है: for(int i=0,j=10;i
A
10 9 8 7 6 10 9 8 7 6
B
1098765 1098765
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) i=0,j=10:10; i=1,j=8:9; i=2,j=6:8; i=3,j=4:7; i=4,j=2:6. Output: 1098 76... concatenated: 1098 76. Without spaces: 109876. Hmm: 10,9,8,7,6 = 109876.
व्याख्या (हिन्दी) i=0,j=10:10; i=1,j=8:9; i=2,j=6:8; i=3,j=4:7; i=4,j=2:6. आउटपुट: 1098 76... संयोजित: 1098 76. रिक्त स्थान के बिना: 109876। हम्म: 10,9,8,7,6 = 109876।
60
EN + हिं
GB What is the output: int x=1; for(int i=0;i<10;i++) x=(x%10)*2; cout<
IN आउटपुट क्या है: int x=1; for(int i=0;i
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1->2->4->8->16%10*2=12... wait: x%10 gives last digit. 1->2->4->8->6(16%10=6,*2=12)->2(12%10=2,*2=4)->4->8->6->2->4. After 10: 4. Hmm, let me recount. Start 1: i=0:2, i=1:4, i=2:8, i=3:6(16%10=6), i=4:2(12%10*2... wait 16%10=6, 6*2=12), i=5:4(12%10=2,2*2=4), i=6:8, i=7:6, i=8:2, i=9:4. Output:4.
व्याख्या (हिन्दी) 1->2->4->8->16%10*2=12... प्रतीक्षा करें: x%10 अंतिम अंक देता है। 1->2->4->8->6(16%10=6,*2=12)->2(12%10=2,*2=4)->4->8->6->2->4। 10:4 के बाद। हम्म, मुझे फिर से गिनने दीजिए। प्रारंभ 1: i=0:2, i=1:4, i=2:8, i=3:6(16%10=6), i=4:2(12%10*2... प्रतीक्षा करें 16%10=6, 6*2=12), i=5:4(12%10=2,2*2=4), i=6:8, i=7:6, i=8:2, i=9:4। आउटपुट:4.
46–60 of 133