OOP Using C++ — MCQ Practice

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

📚 1915 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1915 questions
1186
EN + हिं
GB What is the output: int x=3; cout<<(x|=x<<1);
IN आउटपुट क्या है: int x=3; अदालत
A
7 7
B
6 6
C
3 3
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x<<1=6=110. 3=011. 011|110=111=7. x=7. Output: 7.
व्याख्या (हिन्दी) एक्स
1187
EN + हिं
GB What is the output: int x=5,y=5; cout<<(x^=y,y^=x,x^=y);
IN आउटपुट क्या है: int x=5,y=5; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR swap of equal values: x=5,y=5. x^=y=0; y^=x=5; x^=y=5. Returns x=5. Output: 5.
व्याख्या (हिन्दी) समान मानों का XOR स्वैप: x=5,y=5. x^=y=0; y^=x=5; x^=y=5. x=5 लौटाता है। आउटपुट: 5.
1188
EN + हिं
GB What is the output: int x=5; cout<<(~x+1);
IN आउटपुट क्या है: int x=5; अदालत
A
-5 -5
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~x=-6; -6+1=-5. Output: -5.
व्याख्या (हिन्दी) ~x=-6; -6+1=-5. आउटपुट:-5.
1189
EN + हिं
GB What is the output: int x=10; cout<<(x&1?'O':'E')<<(x>>1);
IN आउटपुट क्या है: int x=10; अदालत
A
E5 E5
B
O5 ओ 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10&1=0: E; 10>>1=5. Output: E5.
व्याख्या (हिन्दी) 10&1=0: ई; 10>>1=5. आउटपुट: E5.
1190
EN + हिं
GB What is the output: int a=5,b=10; a^=b^=a^=b; cout<
IN आउटपुट क्या है: int a=5,b=10; a^=b^=a^=b; अदालत
A
105 105
B
510 510
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Multiple modifications of a without sequencing is UB. Output: UB.
व्याख्या (हिन्दी) अनुक्रमण के बिना एक के एकाधिक संशोधन यूबी है। आउटपुट: यूबी.
1191
EN + हिं
GB What is the output: int x=100; cout<<(x/=10/=1);
IN आउटपुट क्या है: int x=100; अदालत
A
Compile error संकलन त्रुटि
B
10 10
C
100 100
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10/=1 is not valid (10 is not assignable). Compile error.
व्याख्या (हिन्दी) 10/=1 मान्य नहीं है (10 असाइन करने योग्य नहीं है)। संकलन त्रुटि.
1192
EN + हिं
GB What is the output: bool a=true,b=false; a^=b; cout<
IN आउटपुट क्या है: bool a=true,b=false; ए^=बी; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) true^false=true=1. Output: 1.
व्याख्या (हिन्दी) सत्य^झूठा=सत्य=1. आउटपुट: 1.
1193
EN + हिं
GB What is the output: int x=5; cout<<((x%2==0)?"even":"odd");
IN आउटपुट क्या है: int x=5; अदालत
A
odd विषम
B
even यहां तक ​​की
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2=1!=0: odd. Output: odd.
व्याख्या (हिन्दी) 5%2=1!=0: विषम। आउटपुट: विषम.
1194
EN + हिं
GB What is the output: int x=5; cout<<(x&&!x)<<(!x||x);
IN आउटपुट क्या है: int x=5; अदालत
A
01 01
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x&&!x=1&&0=0; !x||x=0||1=1. Output: 01.
व्याख्या (हिन्दी) x&&!x=1&&0=0; !x||x=0||1=1. आउटपुट: 01.
1195
EN + हिं
GB What is the output: int x=7; cout<<(x&~(1<<2));
IN आउटपुट क्या है: int x=7; अदालत
A
3 3
B
7 7
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<<2=4=100. ~4=...11111011. 7=111. 111&011=011=3. Output: 3.
व्याख्या (हिन्दी) 1
1196
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
1197
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.
1198
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.
1199
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.
1200
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.
1186–1200 of 1915