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 661

EN + हिं
GB The output of: int arr[]={1,2,3,4,5}; span s(arr,3); cout<
IN इसका आउटपुट: int arr[]={1,2,3,4,5}; स्पैन s(arr,3); अदालत
1 1
2 2
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) span covers first 3 elements; s[2]=arr[2]=3.
व्याख्या (हिन्दी) स्पैन पहले 3 तत्वों को कवर करता है; s[2]=arr[2]=3.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 662

EN + हिं
GB The output of: span s={1,2,3,4,5}; cout<
IN का आउटपुट: स्पैन s={1,2,3,4,5}; अदालत
1 5 1 5
5 1 5 1
1 4 1 4
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) front()=1, back()=5.
व्याख्या (हिन्दी) सामने()=1, पीछे()=5.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 663

EN + हिं
GB The output of: array a={5,3,1,4,2}; sort(a.begin(),a.end()); cout<
IN का आउटपुट: array a={5,3,1,4,2}; सॉर्ट करें (a.begin(),a.end()); अदालत
15 15
51 51
Error गलती
52 52
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: {1,2,3,4,5}; a[0]=1, a[4]=5.
व्याख्या (हिन्दी) क्रमबद्ध: {1,2,3,4,5}; ए[0]=1, ए[4]=5.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 664

EN + हिं
GB The output of: map m={{1,1},{2,4},{3,9}}; auto it=m.lower_bound(2); cout<first<second;
IN इसका आउटपुट: मानचित्र m={{1,1},{2,4},{3,9}}; ऑटो इट=एम.लोअर_बाउंड(2); अदालत
14 14
24 24
34 34
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) lower_bound(2) finds key>=2; first match is {2,4}.
व्याख्या (हिन्दी) निचला_बाउंड(2) कुंजी>=2 ढूंढता है; पहला मैच {2,4} है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 665

EN + हिं
GB The output of: set s={1,3,5,7,9}; auto it=s.upper_bound(5); cout<<*it;
IN का आउटपुट: सेट s={1,3,5,7,9}; ऑटो इट=एस.अपर_बाउंड(5); अदालत
5 5
6 6
7 7
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) upper_bound(5) finds first element >5 = 7.
व्याख्या (हिन्दी) अपर_बाउंड(5) पहला तत्व >5 = 7 ढूँढता है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 666

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

Question 667

EN + हिं
GB The output of: multimap mm; mm.insert({1,"a"}); mm.insert({1,"b"}); mm.insert({2,"c"}); cout<
IN इसका आउटपुट: मल्टीमैप मिमी; mm.insert({1,"a"}); mm.insert({1,"b"}); mm.insert({2,"c"}); अदालत
1 1
2 2
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Two entries with key 1.
व्याख्या (हिन्दी) कुंजी 1 के साथ दो प्रविष्टियाँ।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 668

EN + हिं
GB The output of: int x=42; const int &cr=x; x=100; cout<
IN का आउटपुट: int x=42; स्थिरांक int &cr=x; x=100; अदालत
42 42
100 100
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) cr is const ref to x; when x changes, cr reflects it.
व्याख्या (हिन्दी) सीआर x के लिए स्थिरांक रेफरी है; जब x बदलता है, तो cr इसे दर्शाता है।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 669

EN + हिं
GB The output of: const int x=5; int *p=const_cast(&x); *p=10; cout<
IN का आउटपुट: const int x=5; int *p=const_cast(&x); *पी=10; अदालत
5 or 10 5 या 10
10 10
5 (modifying const is UB) 5 (संशोधित स्थिरांक यूबी है)
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Modifying a const variable via const_cast is undefined behavior.
व्याख्या (हिन्दी) const_cast के माध्यम से const वैरिएबल को संशोधित करना अपरिभाषित व्यवहार है।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 670

EN + हिं
GB The output of: class A{public:void f()const{cout<<"const";}void f(){cout<<"non-const";}}; const A a; a.f();
IN इसका आउटपुट: क्लास ए {पब्लिक: शून्य एफ() कॉन्स्ट {काउट
non-const गैर स्थिरांक
const कॉन्स्ट
Error गलती
Ambiguous अस्पष्ट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) const object calls const overload.
व्याख्या (हिन्दी) कॉन्स्ट ऑब्जेक्ट कॉन्स्ट ओवरलोड को कॉल करता है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 671

EN + हिं
GB The output of: class A{public:void f()const{cout<<"C";}void f(){cout<<"N";}}; A a; a.f();
IN इसका आउटपुट: क्लास ए {पब्लिक: शून्य एफ() कॉन्स्ट {काउट
C सी
N एन
Error गलती
CN सीएन
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Non-const object calls non-const overload.
व्याख्या (हिन्दी) नॉन-कॉन्स्ट ऑब्जेक्ट नॉन-कॉन्स्ट ओवरलोड को कॉल करता है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 672

EN + हिं
GB The output of: int arr[5]; fill(arr,arr+5,7); cout<
IN The output of: int arr[5]; भरें(arr,arr+5,7); अदालत
77 77
Error गलती
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) fill sets all to 7; arr[0]=7, arr[4]=7.
व्याख्या (हिन्दी) सभी सेटों को 7 तक भरें; आगमन[0]=7, आगमन[4]=7.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 673

EN + हिं
GB The output of: vector v={1,2,3}; v.assign(0); cout<
IN का आउटपुट: वेक्टर v={1,2,3}; v.असाइन(0); अदालत
30 30
50 50
35 35
05 05
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) assign(0): 5 elements all 0; size=5, v[0]=0.
व्याख्या (हिन्दी) असाइन करें(0): 5 तत्व सभी 0; size=5, v[0]=0.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 674

EN + हिं
GB The output of: list l={1,2,3,4,5}; l.remove(3); cout<
IN का आउटपुट: सूची l={1,2,3,4,5}; एल.निकालें(3); अदालत
5 5
4 4
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) remove(3) erases element with value 3; size=4.
व्याख्या (हिन्दी) हटाएं(3) मान 3 वाले तत्व को मिटा देता है; आकार=4.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 675

EN + हिं
GB The output of: list l={3,1,4,1,5}; l.sort(); l.unique(); cout<
IN का आउटपुट: सूची l={3,1,4,1,5}; एल.सॉर्ट(); एल.अद्वितीय(); अदालत
4 4
5 5
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sorted {1,1,3,4,5}; unique removes duplicate 1: {1,3,4,5} = 4.
व्याख्या (हिन्दी) क्रमबद्ध {1,1,3,4,5}; अद्वितीय डुप्लिकेट 1 को हटाता है: {1,3,4,5} = 4।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।