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 886

EN + हिं
GB The output of: int arr[]={1,2,3,4,5}; partial_sort(arr,arr+3,arr+5); cout<
IN इसका आउटपुट: int arr[]={1,2,3,4,5}; आंशिक_सॉर्ट(arr,arr+3,arr+5); अदालत
123 123
345 345
135 135
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) partial_sort: smallest 3 sorted = 1,2,3.
व्याख्या (हिन्दी) आंशिक_सॉर्ट: सबसे छोटा 3 क्रमबद्ध = 1,2,3।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 887

EN + हिं
GB The output of: int arr[]={5,1,4,2,8}; nth_element(arr,arr+2,arr+5); cout<
IN इसका आउटपुट: int arr[]={5,1,4,2,8}; nth_element(arr,arr+2,arr+5); अदालत
4 4
5 5
2 2
8 8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3rd smallest (index 2) of {5,1,4,2,8} = 4.
व्याख्या (हिन्दी) {5,1,4,2,8} का तीसरा सबसे छोटा (सूचकांक 2) = 4।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 888

EN + हिं
GB The output of: vector v={1,2,3,4,5}; auto res=adjacent_find(v.begin(),v.end(),[](int a,int b){return b==a+2;}); cout<<*res;
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; auto res=adjacent_find(v.begin(),v.end(),[](int a,int b){return b==a+2;}); अदालत
1 1
3 3
4 4
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Adjacent where b=a+2: (1,3) at index 0; *res=1.
व्याख्या (हिन्दी) आसन्न जहां b=a+2: (1,3) सूचकांक 0 पर; *रेस=1.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 889

EN + हिं
GB The output of: vector v={1,2,3,2,1}; cout<(v.rbegin(),v.rend())) cout<<"Yes"; else cout<<"No";
IN का आउटपुट: वेक्टर v={1,2,3,2,1}; अदालत
Yes हाँ
No नहीं
Error गलती
Palindrome विलोमपद
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reversed {1,2,3,2,1} equals original; palindrome.
व्याख्या (हिन्दी) उलटा {1,2,3,2,1} मूल के बराबर है; पलिंड्रोम.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 890

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

Question 891

EN + हिं
GB What is the output: vector v={3,1,4,1,5,9,2,6}; sort(v.begin(),v.end()); cout<<*(lower_bound(v.begin(),v.end(),5));
IN आउटपुट क्या है: वेक्टर v={3,1,4,1,5,9,2,6}; क्रमबद्ध करें (v.begin(),v.end()); अदालत
4 4
5 5
6 6
9 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: {1,1,2,3,4,5,6,9}; lower_bound(5) points to 5.
व्याख्या (हिन्दी) क्रमबद्ध: {1,1,2,3,4,5,6,9}; लोअर_बाउंड(5) 5 को इंगित करता है।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 892

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

Question 893

EN + हिं
GB The output of: vector v={1,2,3,4,5}; transform(v.begin(),v.end(),v.begin(),[](int x){return x*x;}); cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; ट्रांसफ़ॉर्म(v.begin(),v.end(),v.begin(),[](int x){रिटर्न x*x;}); अदालत
5 5
25 25
20 20
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5^2=25.
व्याख्या (हिन्दी) 5^2=25.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 894

EN + हिं
GB The output of: int arr[5]={10,20,30,40,50}; auto [mn,mx]=minmax_element(arr,arr+5); cout<<*mn<<" "<<*mx;
IN इसका आउटपुट: int arr[5]={10,20,30,40,50}; ऑटो [mn,mx]=minmax_element(arr,arr+5); अदालत
10 50 10 50
50 10 50 10
20 40 20 40
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min=10, max=50.
व्याख्या (हिन्दी) न्यूनतम=10, अधिकतम=50।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 895

EN + हिं
GB The output of: vector v={1,2,3,4,5}; cout<());
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; अदालत
120 120
15 15
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*1*2*3*4*5=120.
व्याख्या (हिन्दी) 1*1*2*3*4*5=120.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 896

EN + हिं Medium
GB C++ placement new syntax:
IN C++ प्लेसमेंट नया सिंटैक्स:
new T; नया टी;
new(ptr) T(args); नया(पीटीआर) टी(आर्ग);
alloc T at ptr; पीटीआर पर टी आवंटित करें;
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Placement new constructs T at pre-allocated memory ptr.
व्याख्या (हिन्दी) पूर्व-आवंटित मेमोरी पीटीआर पर नए निर्माण टी को प्लेसमेंट।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं — difficulty level "Medium"। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 897

EN + हिं
GB What is the output: int* arr=new int[5]{1,2,3,4,5}; cout<
IN आउटपुट क्या है: int* arr=new int[5]{1,2,3,4,5}; अदालत
2 2
3 3
1 1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) arr[2]=3.
व्याख्या (हिन्दी) गिरफ्तार[2]=3.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 898

EN + हिं
GB The output of: auto ptr=make_unique(5); ptr[2]=42; cout<
IN इसका आउटपुट: auto ptr=make_unique(5); पीटीआर[2]=42; अदालत
Error गलती
42 42
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) unique_ptr supports subscript; ptr[2]=42.
व्याख्या (हिन्दी) यूनिक_पीटीआर सबस्क्रिप्ट का समर्थन करता है; पीटीआर[2]=42.
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 899

EN + हिं
GB The output of: auto sp=make_shared(10); auto sp2=sp; *sp=20; cout<<*sp2;
IN इसका आउटपुट: auto sp=make_shared(10); ऑटो sp2=sp; *एसपी=20; अदालत
10 10
20 20
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sp and sp2 share same object; *sp=20 modifies it; *sp2=20.
व्याख्या (हिन्दी) एसपी और एसपी2 एक ही वस्तु साझा करते हैं; *sp=20 इसे संशोधित करता है; *sp2=20.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 900

EN + हिं
GB The output of: auto sp=make_shared(5); weak_ptr wp=sp; sp.reset(); cout<
IN इसका आउटपुट: auto sp=make_shared(5); कमजोर_पीटीआर wp=sp; एसपी.रीसेट(); अदालत
1 1
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sp reset to null; count=0; object deleted; wp.expired()=true=1.
व्याख्या (हिन्दी) एसपी शून्य पर रीसेट हो गया; गिनती=0; ऑब्जेक्ट हटा दिया गया; wp.समाप्त()=सत्य=1.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।