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 481

EN + हिं
GB The output of: auto f=function([](int n){return n*n;}); cout<
IN इसका आउटपुट: auto f=function([](int n){return n*n;}); अदालत
14 14
49 49
7 7
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::function wraps lambda; 7*7=49.
व्याख्या (हिन्दी) std::फ़ंक्शन लैम्ब्डा को लपेटता है; 7*7=49.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 482

EN + हिं
GB The output of: map freq; string words[]={"a","b","a","c","b","a"}; for(auto w:words)freq[w]++; cout<
IN इसका आउटपुट: मानचित्र आवृत्ति; स्ट्रिंग शब्द[]={"a","b","a","c","b","a"}; for(auto w:words)freq[w]++; अदालत
321 321
123 123
312 312
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a appears 3 times, b 2 times, c 1 time.
व्याख्या (हिन्दी) a 3 बार, b 2 बार, c 1 बार प्रकट होता है।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 483

EN + हिं
GB The output of: vector> v={{3,1},{1,3},{2,2}}; sort(v.begin(),v.end()); cout<
IN का आउटपुट: वेक्टर v={{3,1},{1,3},{2,2}}; क्रमबद्ध करें (v.begin(),v.end()); अदालत
31 31
13 13
22 22
11 11
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Default sort on pair: sorts by first then second; {1,3} is smallest.
व्याख्या (हिन्दी) जोड़ी पर डिफ़ॉल्ट सॉर्ट: पहले और फिर दूसरे के आधार पर सॉर्ट करें; {1,3} सबसे छोटा है.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 484

EN + हिं
GB The output of: priority_queue> pq; pq.push({1,2}); pq.push({3,1}); pq.push({2,3}); cout<
IN इसका आउटपुट: प्राथमिकता_क्यू पीक्यू; pq.push({1,2}); pq.push({3,1}); pq.push({2,3}); अदालत
1 1
2 2
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Max-heap on pair: {3,1} has highest first element = 3.
व्याख्या (हिन्दी) जोड़ी पर अधिकतम-ढेर: {3,1} में उच्चतम पहला तत्व = 3 है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 485

EN + हिं
GB The output of: auto it=find(begin({5,3,8,1,9}),end({5,3,8,1,9}),8); cout<<*it;
IN इसका आउटपुट: auto it=find(begin({5,3,8,1,9}),end({5,3,8,1,9}),8); अदालत
5 5
3 3
8 8
9 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) find returns iterator to first occurrence of 8.
व्याख्या (हिन्दी) 8 की पहली घटना पर रिटर्न इटरेटर ढूंढें।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 486

EN + हिं Hard
GB What is the time complexity of std::sort?
IN std::sort की समय जटिलता क्या है?
O(n^2) ओ(एन^2)
O(n log n) average ओ(एन लॉग एन) औसत
O(n) पर)
O(log n) ओ(लॉग एन)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::sort is O(n log n) average (introsort).
व्याख्या (हिन्दी) std::sort O(n log n) औसत (introsort) है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Hard"। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 487

EN + हिं Hard
GB What is the space complexity of merge sort?
IN मर्ज सॉर्ट की स्थानिक जटिलता क्या है?
O(1) हे(1)
O(n) पर)
O(log n) ओ(लॉग एन)
O(n^2) ओ(एन^2)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Merge sort needs O(n) extra space for merging.
व्याख्या (हिन्दी) मर्ज सॉर्ट को विलय के लिए O(n) अतिरिक्त स्थान की आवश्यकता होती है।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल — difficulty level "Hard" उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 488

EN + हिं Hard
GB What is the space complexity of quicksort (average)?
IN क्विकॉर्ट (औसत) की स्थानिक जटिलता क्या है?
O(1) हे(1)
O(log n) recursion stack ओ(लॉग एन) रिकर्सन स्टैक
O(n) पर)
O(n^2) ओ(एन^2)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) QuickSort average: O(log n) stack depth.
व्याख्या (हिन्दी) क्विकसॉर्ट औसत: ओ(लॉग एन) स्टैक गहराई।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Hard"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 489

EN + हिं Hard
GB What is the space complexity of heap sort?
IN ढेर प्रकार की अंतरिक्ष जटिलता क्या है?
O(n) पर)
O(1) in-place O(1) इन-प्लेस
O(log n) ओ(लॉग एन)
O(n log n) ओ(एन लॉग एन)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Heapsort is in-place: O(1) extra space.
व्याख्या (हिन्दी) हीप्सॉर्ट अपनी जगह पर है: O(1) अतिरिक्त जगह।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Hard"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 490

EN + हिं Medium
GB Which sort is best for nearly sorted arrays?
IN लगभग क्रमबद्ध सरणियों के लिए कौन सा प्रकार सर्वोत्तम है?
Quick Sort त्वरित छँटाई
Merge Sort मर्ज सॉर्ट करें
Insertion Sort प्रविष्टि क्रम
Heap Sort ढेर बनाएं और छांटें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Insertion sort is O(n) for nearly sorted arrays.
व्याख्या (हिन्दी) लगभग क्रमबद्ध सरणियों के लिए सम्मिलन सॉर्ट O(n) है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 491

EN + हिं Medium
GB Which sort is best for linked lists?
IN लिंक्ड सूचियों के लिए कौन सा प्रकार सर्वोत्तम है?
Quick Sort त्वरित छँटाई
Merge Sort मर्ज सॉर्ट करें
Heap Sort ढेर बनाएं और छांटें
Insertion Sort प्रविष्टि क्रम
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Merge sort works well on linked lists without extra memory.
व्याख्या (हिन्दी) मर्ज सॉर्ट अतिरिक्त मेमोरी के बिना लिंक्ड सूचियों पर अच्छा काम करता है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है — difficulty level "Medium", और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 492

EN + हिं Medium
GB Counting sort is not a comparison sort and runs in:
IN गिनती सॉर्ट तुलनात्मक सॉर्ट नहीं है और इसमें चलता है:
O(n log n) ओ(एन लॉग एन)
O(n + k) where k is range of values O(n + k) जहां k मानों की सीमा है
O(n^2) ओ(एन^2)
O(k) ठीक है)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Counting sort: O(n+k) time and space.
व्याख्या (हिन्दी) गिनती क्रम: O(n+k) समय और स्थान।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 493

EN + हिं Hard
GB Radix sort time complexity for n numbers with d digits:
IN डी अंकों के साथ एन संख्याओं के लिए रेडिक्स सॉर्ट समय जटिलता:
O(d*n) ओ(डी*एन)
O(n log n) ओ(एन लॉग एन)
O(n^2) ओ(एन^2)
O(d*n) = O(n) if d is constant O(d*n) = O(n) यदि d स्थिर है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Radix: O(d*(n+k)) where k is digit range.
व्याख्या (हिन्दी) मूलांक: O(d*(n+k)) जहां k अंक सीमा है।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल — difficulty level "Hard" उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 494

EN + हिं Medium
GB Bucket sort is efficient when input is:
IN इनपुट होने पर बकेट सॉर्ट कुशल होता है:
Any data कोई भी डेटा
Uniformly distributed in a known range ज्ञात सीमा में समान रूप से वितरित
Sorted already पहले से ही क्रमबद्ध
Integer only केवल पूर्णांक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Bucket sort: O(n) average for uniform distribution.
व्याख्या (हिन्दी) बकेट सॉर्ट: समान वितरण के लिए O(n) औसत।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 495

EN + हिं Medium
GB Shell sort is a generalization of:
IN शेल सॉर्ट इसका सामान्यीकरण है:
Merge sort मर्ज सॉर्ट
Insertion sort (with gap sequences) सम्मिलन क्रम (अंतराल अनुक्रम के साथ)
Quick sort त्वरित छँटाई
Heap sort ढेर बनाएं और छांटें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Shell sort: insertion sort with diminishing gaps.
व्याख्या (हिन्दी) शैल प्रकार: घटते अंतराल के साथ सम्मिलन प्रकार।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Medium"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।