Data Structures and Algorithms — MCQ Practice

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

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

Question 526

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 ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 527

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 ("Introduction to DSA" sub-topic) category का है — difficulty level "Medium", और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 528

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 ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 529

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
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 530

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
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 531

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
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 532

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 ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 533

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 ("Introduction to DSA" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 534

EN + हिं Medium
GB Which is correct for checking if number is even without %?
IN यह जांचने के लिए कौन सा सही है कि संख्या % के बिना भी है या नहीं?
n%2==0 n%2==0
(n&1)==0 (bitwise AND with 1 checks last bit) (n&1)==0 (बिटवाइज और अंतिम बिट 1 चेक के साथ)
n/2*2==n एन/2*2==एन
All equivalent सभी समकक्ष
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All three methods check for even number.
व्याख्या (हिन्दी) तीनों विधियाँ सम संख्या की जाँच करती हैं।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 535

EN + हिं
GB The output of: int a=3,b=3; cout<<(a==b && !(a^b));
IN का आउटपुट: int a=3,b=3; अदालत
1 1
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3==3 true AND !(3^3)=!(0)=true; both true = 1.
व्याख्या (हिन्दी) 3==3 सत्य और !(3^3)=!(0)=सत्य; दोनों सत्य = 1.
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 536

EN + हिं Medium
GB To multiply by 4 using bit shift:
IN बिट शिफ्ट का उपयोग करके 4 से गुणा करने के लिए:
n*4 एन*4
n<<2 (left shift by 2 = multiply by 2^2=4) एन
n>>2 n>>2
n^4 एन^4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n<<2 is equivalent to n*4.
व्याख्या (हिन्दी) एन
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 537

EN + हिं Medium
GB To divide by 8 using bit shift:
IN बिट शिफ्ट का उपयोग करके 8 से विभाजित करने के लिए:
n/8 एन/8
n>>3 (right shift by 3 = divide by 2^3=8) n>>3 (3 से दायां बदलाव = 2^3=8 से भाग दें)
n<<3 एन
n&8 एन&8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n>>3 is equivalent to n/8 for positive n.
व्याख्या (हिन्दी) n>>3 सकारात्मक n के लिए n/8 के बराबर है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Medium"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 538

EN + हिं
GB The output of: int x=100; cout<<(x/10)<<(x%10);
IN का आउटपुट: int x=100; अदालत
100 100
10 0 10 0
100 100
1 0 0 1 0 0
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x/10=10, x%10=0; cout<<10<<0 = 100.
व्याख्या (हिन्दी) x/10=10, x%10=0; अदालत
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 539

EN + हिं
GB The output of: string s=""; for(int i=65;i<70;i++) s+=(char)i; cout<
IN इसका आउटपुट: स्ट्रिंग s=''; for(int i=65;i
ABCDE एबीसीडीई
abcde एबीसीडीई
12345 12345
EFGHI ईएफजीएचआई
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ASCII 65-69 = A,B,C,D,E.
व्याख्या (हिन्दी) एएससीआईआई 65-69 = ए, बी, सी, डी, ई।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 540

EN + हिं
GB Which OOP concept is violated when a class has public data members?
IN जब किसी वर्ग में सार्वजनिक डेटा सदस्य होते हैं तो किस OOP अवधारणा का उल्लंघन होता है?
Polymorphism बहुरूपता
Encapsulation (data hiding) एनकैप्सुलेशन (डेटा छिपाना)
Inheritance विरासत
Abstraction मतिहीनता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Public data breaks encapsulation; should be private with accessors.
व्याख्या (हिन्दी) सार्वजनिक डेटा एनकैप्सुलेशन तोड़ता है; एक्सेसर्स के साथ निजी होना चाहिए।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।