Data Structures and Algorithms — MCQ Practice

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

📚 1018 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1018 questions

Question 376

EN + हिं
GB The output of: int a=10,b=5; a=a^b; b=a^b; a=a^b; cout<
IN का आउटपुट: int a=10,b=5; ए=ए^बी; बी=ए^बी; ए=ए^बी; अदालत
5 10 5 10
10 5 10 5
15 15 15 15
0 0 0 0
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR swap: a=5, b=10.
व्याख्या (हिन्दी) एक्सओआर स्वैप: ए=5, बी=10।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 377

EN + हिं
GB The output of: for(int i=1;i<=5;i++) cout<
IN का आउटपुट: for(int i=1;i
1 3 6 10 15 1 3 6 10 15
1 2 3 4 5 1 2 3 4 5
2 6 12 20 30 2 6 12 20 30
1 4 9 16 25 1 4 9 16 25
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Triangular numbers: 1, 3, 6, 10, 15.
व्याख्या (हिन्दी) त्रिकोणीय संख्याएँ: 1, 3, 6, 10, 15.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 378

EN + हिं
GB The output of: int n=16; while(n>1){n/=2; cout<
IN का आउटपुट: int n=16; जबकि(n>1){n/=2; अदालत
8 4 2 1 8 4 2 1
8 4 2 8 4 2
16 8 4 2 16 8 4 2
4 2 1 4 2 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 16/2=8, 8/2=4, 4/2=2, 2/2=1.
व्याख्या (हिन्दी) 16/2=8, 8/2=4, 4/2=2, 2/2=1।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 379

EN + हिं
GB The output of: int x=255; cout<<(x & 0x0F);
IN इसका आउटपुट: int x=255; अदालत
255 255
15 15
240 240
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 255=11111111, 0x0F=00001111; AND=00001111=15.
व्याख्या (हिन्दी) 255=11111111, 0x0F=00001111; तथा=00001111=15.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 380

EN + हिं
GB The output of: int x=170; cout<<(x & 0xFF)<<" "<<(x>>4);
IN का आउटपुट: int x=170; अदालत
170 10 170 10
170 26 170 26
10 170 10 170
26 170 26 170
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 170&255=170; 170>>4=10 (170/16=10).
व्याख्या (हिन्दी) 170&255=170; 170>>4=10 (170/16=10)।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 381

EN + हिं
GB The output of: int n=7; cout<<__builtin_popcount(n);
IN का आउटपुट: int n=7; अदालत
7 7
3 3
1 1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7=0111 has 3 set bits; __builtin_popcount(7)=3.
व्याख्या (हिन्दी) 7=0111 में 3 सेट बिट हैं; __बिल्टइन_पॉपकाउंट(7)=3.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 382

EN + हिं
GB The output of: cout<<__builtin_clz(8); on 32-bit int?
IN का आउटपुट: कॉउट
3 3
28 28
29 29
4 4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 8=...00001000; leading zeros before first 1 bit = 32-4=28.
व्याख्या (हिन्दी) 8=...00001000; पहले 1 बिट से पहले अग्रणी शून्य = 32-4=28।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 383

EN + हिं
GB The output of: int x=12; cout<<(x&(x-1));
IN का आउटपुट: int x=12; अदालत
8 8
4 4
12 12
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 12=1100, 11=1011; 12&11=1000=8.
व्याख्या (हिन्दी) 12=1100, 11=1011; 12&11=1000=8.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 384

EN + हिं Medium
GB n & (n-1) equals 0 iff n is:
IN n और (n-1) 0 के बराबर है यदि n है:
Even यहां तक ​​की
Power of 2 (or n=0) 2 की शक्ति (या n=0)
Odd विषम
Prime मुख्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Only power of 2 has single set bit; n-1 clears it.
व्याख्या (हिन्दी) केवल 2 की शक्ति में सिंगल सेट बिट है; n-1 इसे साफ़ करता है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 385

EN + हिं
GB What is the output: cout<<(0b1010 | 0b1100);
IN आउटपुट क्या है: cout
14 14
12 12
10 10
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010|1100=1110=14.
व्याख्या (हिन्दी) 1010|1100=1110=14.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 386

EN + हिं
GB What is the output: cout<<(0b1010 & 0b1100);
IN आउटपुट क्या है: cout
14 14
8 8
2 2
10 10
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010&1100=1000=8.
व्याख्या (हिन्दी) 1010&1100=1000=8.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 387

EN + हिं
GB What is the output: cout<<(0b1010 ^ 0b1100);
IN आउटपुट क्या है: cout
14 14
8 8
6 6
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010^1100=0110=6.
व्याख्या (हिन्दी) 1010^1100=0110=6.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 388

EN + हिं
GB The output of: cout<<~0;
IN का आउटपुट: कॉउट
-1 -1
1 1
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~0 flips all bits of 0 = all 1s = -1 in two complement.
व्याख्या (हिन्दी) ~0, 0 के सभी बिट्स = सभी 1s = -1 को दो पूरक में फ़्लिप करता है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 389

EN + हिं
GB What is the output: int x=0x1234; cout<<((x>>8)&0xFF)<<" "<<(x&0xFF);
IN आउटपुट क्या है: int x=0x1234; cout8)&0xFF)
18 52 18 52
0x12 0x34 0x12 0x34
12 34 12 34
34 18 34 18
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) High byte: (0x1234>>8)&0xFF=0x12=18; Low byte: 0x34=52.
व्याख्या (हिन्दी) उच्च बाइट: (0x1234>>8)&0xFF=0x12=18; निम्न बाइट: 0x34=52.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 390

EN + हिं
GB The output of: float f=3.14f; int i=*(int*)&f; is:
IN इसका आउटपुट: फ्लोट f=3.14f; int i=*(int*)&f; है:
3 3
314 314
A specific integer bit pattern (type punning) एक विशिष्ट पूर्णांक बिट पैटर्न (टाइप पनिंग)
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Type punning reinterprets float bits as int - UB in C++.
व्याख्या (हिन्दी) टाइप पनिंग C++ में फ्लोट बिट्स को int - UB के रूप में पुनर्व्याख्यायित करता है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।