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
106
EN + हिं
GB What is the output: int x=3; cout<<(x|(1<<3));
IN आउटपुट क्या है: int x=3; अदालत
A
11 11
B
3 3
C
8 8
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<<3=8=1000. 3=0011. 1000|0011=1011=11. Output: 11.
व्याख्या (हिन्दी) 1
107
EN + हिं
GB What is the output: int x=7; cout<<((x>>1)^(x>>2));
IN आउटपुट क्या है: int x=7; cout1)^(x>>2));
A
2 2
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7>>1=3=011; 7>>2=1=001. 011^001=010=2. Output: 2.
व्याख्या (हिन्दी) 7>>1=3=011; 7>>2=1=001. 011^001=010=2. आउटपुट: 2.
108
EN + हिं
GB What is the output: int x=5; cout<<(x*(x-1)>>1);
IN आउटपुट क्या है: int x=5; cout1);
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5*4>>1=20>>1=10. Output: 10.
व्याख्या (हिन्दी) 5*4>>1=20>>1=10. आउटपुट: 10.
109
EN + हिं
GB What is the output: int x=255; cout<<(x^(x>>4));
IN आउटपुट क्या है: int x=255; cout4));
A
240 240
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 255=11111111; 255>>4=00001111=15. 11111111^00001111=11110000=240. Output: 240.
व्याख्या (हिन्दी) 255=11111111; 255>>4=00001111=15. 11111111^00001111=11110000=240. आउटपुट: 240.
110
EN + हिं
GB What is the output: int x=6; cout<<(x&-x);
IN आउटपुट क्या है: int x=6; अदालत
A
2 2
B
6 6
C
4 4
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6=110; -6=...010. 110&010=010=2. Output: 2.
व्याख्या (हिन्दी) 6=110; -6=...010. 110&010=010=2. आउटपुट: 2.
111
EN + हिं
GB What is the output: int x=5; cout<<(x*x+x+1)%7;
IN आउटपुट क्या है: int x=5; अदालत
A
3 3
B
31 31
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 31%7=3. Output: 3.
व्याख्या (हिन्दी) 31%7=3. आउटपुट: 3.
112
EN + हिं
GB What is the output: int x=0; cout<<(x (1, 6, 73, 3, 4, 'What is the output: int x=16; while(x&(x-1)) x&=x-1; cout<
IN आउटपुट क्या है: int x=0; अदालत
A
2026-05-25 2026-05-25
✅ Correct Answer:
113
EN + हिं
GB What is the output: int x=16; while(x&(x-1)) x&=x-1; cout<
IN आउटपुट क्या है: int x=16; जबकि(x&(x-1)) x&=x-1; अदालत
A
16 16
B
8 8
C
1 1
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 16=10000; 16&15=0: already power of 2. Loop doesn't run. Output: 16.
व्याख्या (हिन्दी) 16=10000; 16&15=0: पहले से ही 2 की शक्ति। लूप नहीं चलता। आउटपुट: 16.
114
EN + हिं
GB What is the output: int x=5; cout<<(x+(x>>31));
IN आउटपुट क्या है: int x=5; cout31));
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>>31 for positive x=0 (sign extension). x+0=5. Output: 5.
व्याख्या (हिन्दी) x>>31 सकारात्मक x=0 के लिए (चिह्न विस्तार)। x+0=5. आउटपुट: 5.
115
EN + हिं
GB What is the output: int x=5; cout<<((x>>31)^x)-((x>>31));
IN आउटपुट क्या है: int x=5; cout31)^x)-((x>>31));
A
5 5
B
-5 -5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) For positive: mask=0. (0^5)-0=5. Output: 5.
व्याख्या (हिन्दी) सकारात्मक के लिए: मुखौटा=0. (0^5)-0=5. आउटपुट: 5.
116
EN + हिं
GB What is the output: int x=5,y=3; cout<<(x^y^y);
IN आउटपुट क्या है: int x=5,y=3; अदालत
A
5 5
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) y^y=0; x^0=x=5. Output: 5.
व्याख्या (हिन्दी) y^y=0; x^0=x=5. आउटपुट: 5.
117
EN + हिं
GB What is the output: int x=5; cout<<(x!=0?1:0)<<(x>0?1:-1);
IN आउटपुट क्या है: int x=5; अदालत
A
11 11
B
1-1 1-1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x!=0=1; x>0=1. Output: 11.
व्याख्या (हिन्दी) एक्स!=0=1; x>0=1. आउटपुट: 11.
118
EN + हिं
GB What is the output: int a=4,b=7; cout<<(a|b)-(a&b);
IN आउटपुट क्या है: int a=4,b=7; अदालत
A
3 3
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a|b=7, a&b=4. 7-4=3. a^b=4^7=011=3. Output: 3.
व्याख्या (हिन्दी) ए|बी=7, ए&बी=4. 7-4=3. a^b=4^7=011=3. आउटपुट: 3.
119
EN + हिं
GB What is the output: int x=5; cout<<(x+0)<<(x*1)<<(x-0)<<(x/1);
IN आउटपुट क्या है: int x=5; अदालत
A
5555 5555
B
0155 0155
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5+0=5, 5*1=5, 5-0=5, 5/1=5. Output: 5555.
व्याख्या (हिन्दी) 5+0=5, 5*1=5, 5-0=5, 5/1=5। आउटपुट: 5555.
120
EN + हिं
GB What is the output: unsigned x=5; cout<<(-x);
IN आउटपुट क्या है: unsigned x=5; अदालत
A
4294967291 4294967291
B
-5 -5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) -(unsigned)5=UINT_MAX-5+1=4294967291. Output: 4294967291.
व्याख्या (हिन्दी) -(अहस्ताक्षरित)5=UINT_MAX-5+1=4294967291. आउटपुट: 4294967291.
106–120 of 163