OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 163 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
163 questions
136
EN + हिं
GB What is the output: int x=0b11111111; cout<<(x&0x55)+(x&0xAA);
IN आउटपुट क्या है: int x=0b11111111; अदालत
A
255 255
B
128 128
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0x55=85, 0xAA=170. x&0x55=85, x&0xAA=170. 85+170=255. Output: 255.
व्याख्या (हिन्दी) 0x55=85, 0xAA=170. x&0x55=85, x&0xAA=170. 85+170=255. आउटपुट: 255.
137
EN + हिं
GB What is the output: int x=5; cout<<(x*x+2*x+1);
IN आउटपुट क्या है: int x=5; अदालत
A
36 36
B
25 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6^2=36. Output: 36.
व्याख्या (हिन्दी) 6^2=36. आउटपुट: 36.
138
EN + हिं
GB What is the output: int x=5; cout<<(x-1)*(x+1)<<' '<
IN आउटपुट क्या है: int x=5; अदालत
A
24 24 24 24
B
24 25 24 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4*6=24; 25-1=24. Output: 24 24.
व्याख्या (हिन्दी) 4*6=24; 25-1=24. आउटपुट: 24 24.
139
EN + हिं
GB What is the output: bool a=1>0, b=2>3; cout<<(a&&b)<<(a||b)<<(a^b);
IN आउटपुट क्या है: bool a=1>0, b=2>3; अदालत
A
011 011
B
101 101
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=1,b=0. &&=0, ||=1, ^=1. Output: 011.
व्याख्या (हिन्दी) ए=1,बी=0. &&=0, ||=1, ^=1. आउटपुट: 011.
140
EN + हिं
GB What is the output: int x=7; cout<<(x&0x1)<<(x&0x2)<<(x&0x4);
IN आउटपुट क्या है: int x=7; अदालत
A
124 124
B
142 142
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7&1=1; 7&2=2; 7&4=4. Output: 124.
व्याख्या (हिन्दी) 7&1=1; 7&2=2; 7&4=4. आउटपुट: 124.
141
EN + हिं
GB What is the output: int x=5; cout<<((x%2==0)?"even":"odd")<
IN आउटपुट क्या है: int x=5; अदालत
A
odd5 अजीब5
B
even5 सम5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2!=0: odd. Output: odd5.
व्याख्या (हिन्दी) 5%2!=0: विषम। आउटपुट: विषम5.
142
EN + हिं
GB What is the output: int x=10; x+=x; x-=5; x*=2; cout<
IN आउटपुट क्या है: int x=10; x+=x; एक्स-=5; एक्स*=2; अदालत
A
30 30
B
25 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=10; x+=10=20; x-=5=15; x*=2=30. Output: 30.
व्याख्या (हिन्दी) एक्स=10; x+=10=20; x-=5=15; x*=2=30. Output: 30.
143
EN + हिं
GB What is the output: int x=5; int y=(x>0)+(x>1)+(x>2)+(x>3)+(x>4)+(x>5);
IN आउटपुट क्या है: int x=5; int y=(x>0)+(x>1)+(x>2)+(x>3)+(x>4)+(x>5);
A
5 5
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5>0,1,2,3,4=1 each; 5>5=0. Sum=5. Output: 5.
व्याख्या (हिन्दी) 5>0,1,2,3,4=1 प्रत्येक; 5>5=0. योग=5. आउटपुट: 5.
144
EN + हिं
GB What is the output: int a=3,b=4; cout<<(a*a+b*b)<<' '<<(a+b)*(a+b);
IN आउटपुट क्या है: int a=3,b=4; अदालत
A
25 49 25 49
B
49 25 49 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 9+16=25; 7^2=49. Output: 25 49.
व्याख्या (हिन्दी) 9+16=25; 7^2=49. आउटपुट: 25 49.
145
EN + हिं
GB What is the output: cout<<(1<<0|1<<1|1<<2|1<<3);
IN आउटपुट क्या है: cout
A
15 15
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1|2|4|8=15. Output: 15.
व्याख्या (हिन्दी) 1|2|4|8=15. आउटपुट: 15.
146
EN + हिं
GB What is the output: int x=255; cout<<(x&0xF)<<((x>>4)&0xF);
IN आउटपुट क्या है: int x=255; अदालत
A
1515 1515
B
0F0F 0एफ0एफ
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0xFF&0xF=15; 0xF>>4&0xF=15. Output: 1515.
व्याख्या (हिन्दी) 0xFF&0xF=15; 0xF>>4&0xF=15. आउटपुट: 1515.
147
EN + हिं
GB What is the output: int x=5,y=10; cout<<(xy?x:y);
IN आउटपुट क्या है: int x=5,y=10; अदालत
A
5 10 5 10
B
10 5 10 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min=5, max=10. Output: 5 10.
व्याख्या (हिन्दी) न्यूनतम=5, अधिकतम=10. आउटपुट: 5 10.
148
EN + हिं
GB What is the output: int a=5; cout<<(a&=3)<
IN आउटपुट क्या है: int a=5; अदालत
A
11 11
B
33 33
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5&3=1; a=1. C++17: (a&=3) returns 1, then a=1. Output: 11.
व्याख्या (हिन्दी) 5&3=1; ए=1. सी++17: (ए&=3) 1 लौटाता है, फिर ए=1। आउटपुट: 11.
149
EN + हिं
GB What is the output: int x=2; for(int i=0;i<4;i++) x=x<<1|1; cout<
IN आउटपुट क्या है: int x=2; for(int i=0;i
A
63 63
B
31 31
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2->5->11->23->47. Let me recheck: x=2=010. i=0:010<<1|1=101=5; i=1:101<<1|1=1011=11; i=2:1011<<1|1=10111=23; i=3:10111<<1|1=101111=47. Output: 47.
व्याख्या (हिन्दी) 2->5->11->23->47. मुझे दोबारा जांच करने दीजिए: x=2=010. मैं=0:010
150
EN + हिं
GB What is the output: int x=5; cout<<(x|(x<<4));
IN आउटपुट क्या है: int x=5; अदालत
A
85 85
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5=00000101; 5<<4=01010000=80. OR=01010101=85. Output: 85.
व्याख्या (हिन्दी) 5=00000101; 5
136–150 of 163