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 511

EN + हिं Medium
GB Two-pointer technique is used for:
IN टू-पॉइंटर तकनीक का उपयोग इसके लिए किया जाता है:
Sorting छंटाई
Efficiently solving array/string problems with two indices moving toward each other दो सूचकांकों के एक-दूसरे की ओर बढ़ने के साथ सरणी/स्ट्रिंग समस्याओं को कुशलतापूर्वक हल करना
Graph traversal ग्राफ ट्रैवर्सल
DP problems डीपी समस्याएं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Two-pointer: O(n) for problems like pair sum, palindrome check.
व्याख्या (हिन्दी) दो-सूचक: जोड़ी योग, पैलिंड्रोम जांच जैसी समस्याओं के लिए ओ(एन)।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल — difficulty level "Medium" उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 512

EN + हिं Medium
GB Sliding window technique is used for:
IN स्लाइडिंग विंडो तकनीक का उपयोग निम्न के लिए किया जाता है:
Graph problems ग्राफ़ समस्याएँ
Finding optimal subarray/substring of fixed or variable size निश्चित या परिवर्तनीय आकार की इष्टतम उपसरणी/सबस्ट्रिंग ढूँढना
Sorting छंटाई
DP tables डीपी टेबल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sliding window: O(n) for subarray problems.
व्याख्या (हिन्दी) स्लाइडिंग विंडो: उपसरणी समस्याओं के लिए O(n)।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 513

EN + हिं Medium
GB Kadane algorithm maintains:
IN कडेन एल्गोरिदम बनाए रखता है:
Global minimum वैश्विक न्यूनतम
Current subarray sum and global maximum वर्तमान उपसरणी योग और वैश्विक अधिकतम
All subarray sums सभी उपसरणी योग
Average sum औसत योग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Kadane: maxEndingHere = max(arr[i], maxEndingHere + arr[i]).
व्याख्या (हिन्दी) कदाने: maxEndingHere = max(arr[i], maxEndingHere + arr[i]).
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Medium"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 514

EN + हिं Medium
GB The stock buy-sell problem (one transaction) is solved in:
IN स्टॉक खरीदने-बेचने की समस्या (एक लेनदेन) को हल किया जाता है:
O(n^2) ओ(एन^2)
O(n) by tracking minimum price seen so far O(n) अब तक देखी गई न्यूनतम कीमत पर नज़र रखकर
O(n log n) ओ(एन लॉग एन)
O(1) हे(1)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) One pass: track min, compute max profit at each step.
व्याख्या (हिन्दी) एक पास: न्यूनतम ट्रैक करें, प्रत्येक चरण पर अधिकतम लाभ की गणना करें।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 515

EN + हिं Medium
GB Finding majority element (appearing > n/2 times) is solved by:
IN बहुसंख्यक तत्व ढूँढना (प्रकट होना > n/2 बार) निम्न द्वारा हल किया जाता है:
Sorting छंटाई
Boyer-Moore Voting Algorithm in O(n) ओ(एन) में बॉयर-मूर वोटिंग एल्गोरिदम
Hash map हैश मानचित्र
Binary search द्विआधारी खोज
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Boyer-Moore Voting: O(n) time, O(1) space.
व्याख्या (हिन्दी) बॉयर-मूर वोटिंग: O(n) समय, O(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 516

EN + हिं Medium
GB Reservoir sampling is used for:
IN जलाशय नमूनाकरण का उपयोग इसके लिए किया जाता है:
Sorting large data बड़े डेटा को क्रमबद्ध करना
Randomly selecting k items from stream of unknown size in O(n) O(n) में अज्ञात आकार की स्ट्रीम से यादृच्छिक रूप से k आइटम का चयन करना
Hashing हैशिंग
Graph sampling ग्राफ़ नमूनाकरण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reservoir sampling: uniform random sample from stream.
व्याख्या (हिन्दी) जलाशय नमूनाकरण: धारा से एकसमान यादृच्छिक नमूना।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 517

EN + हिं
GB The output of: int x=5; cout<<((x%2)==0?"Even":"Odd");
IN का आउटपुट: int x=5; अदालत
Even यहां तक ​​की
Odd विषम
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2=1, not 0, so Odd.
व्याख्या (हिन्दी) 5%2=1, 0 नहीं, अत: अजीब।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 518

EN + हिं
GB The output of: int n=100; int sum=n*(n+1)/2; cout<
IN इसका आउटपुट: int n=100; int sum=n*(n+1)/2; अदालत
5050 5050
4950 4950
5100 5100
100 100
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Gauss formula: 100*101/2 = 5050.
व्याख्या (हिन्दी) गॉस सूत्र: 100*101/2 = 5050।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 519

EN + हिं
GB The output of: int a=10,b=5; a=a^b; b=a^b; a=a^b; cout<
IN The output of: 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
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 520

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

Question 521

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

Question 522

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

Question 523

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

Question 524

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

Question 525

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