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 1006

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

Question 1007

EN + हिं
GB The output of: int arr[5]; fill(arr,arr+5,7); cout<
IN इसका आउटपुट: 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 category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1008

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

Question 1009

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

Question 1010

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

Question 1011

EN + हिं
GB The output of: vector v={1,2,3,4,5}; auto r=remove_if(v.begin(),v.end(),[](int x){return x%2==0;}); v.erase(r,v.end()); cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; ऑटो r=remove_if(v.begin(),v.end(),[](int x){return x%2==0;}); v.erase(r,v.end()); अदालत
3 3
2 2
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove even {2,4}; remaining odd {1,3,5} = 3.
व्याख्या (हिन्दी) सम {2,4} हटाएं; शेष विषम {1,3,5} = 3.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1012

EN + हिं
GB The output of: forward_list fl={1,2,3}; fl.push_front(0); cout<
IN इसका आउटपुट: फ़ॉर्वर्ड_लिस्ट fl={1,2,3}; fl.push_front(0); अदालत
1 1
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) push_front adds 0; front=0.
व्याख्या (हिन्दी) पुश_फ़्रंट 0 जोड़ता है; सामने=0.
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1013

EN + हिं Medium
GB forward_list vs list in C++:
IN C++ में फ़ॉर्वर्ड_लिस्ट बनाम सूची:
Same thing एक ही बात
forward_list is singly-linked (no backward traversal, less memory) फॉरवर्ड_लिस्ट एकल-लिंक्ड है (कोई बैकवर्ड ट्रैवर्सल नहीं, कम मेमोरी)
forward_list is doubly-linked फॉरवर्ड_लिस्ट डबल-लिंक्ड है
list is faster सूची तेज़ है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) forward_list: singly-linked, only forward iteration.
व्याख्या (हिन्दी) फ़ॉरवर्ड_लिस्ट: एकल-लिंक्ड, केवल फ़ॉरवर्ड पुनरावृत्ति।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है — difficulty level "Medium", और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1014

EN + हिं
GB The output of: auto r=views::iota(1,6)|views::transform([](int x){return x*x;})|views::take(3); for(auto x:r)cout<
IN का आउटपुट: ऑटो r=views::iota(1,6)|views::transform([](int x){return x*x;})|views::take(3); for(auto x:r)cout
1 4 9 1 4 9
1 4 9 16 25 1 4 9 16 25
4 9 16 4 9 16
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) iota 1-5, squared: 1,4,9,16,25; take(3): 1,4,9.
व्याख्या (हिन्दी) आयोटा 1-5, वर्ग: 1,4,9,16,25; ले(3): 1,4,9.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1015

EN + हिं
GB The output of: int n=2; while(n<=100){cout<
IN का आउटपुट: int n=2; जबकि(एन
2 4 8 16 32 64 2 4 8 16 32 64
2 4 8 16 32 64 128 2 4 8 16 32 64 128
1 2 4 8 1 2 4 8
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Powers of 2 up to 100: 2,4,8,16,32,64.
व्याख्या (हिन्दी) 2 की घातें 100 तक: 2,4,8,16,32,64.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1016

EN + हिं
GB The output of: int arr[]={1,2,3,4,5}; int*p=arr+2; cout<<*(p-1)<<*p<<*(p+1);
IN इसका आउटपुट: int arr[]={1,2,3,4,5}; int*p=arr+2; अदालत
234 234
123 123
345 345
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p points to arr[2]=3; p-1=arr[1]=2; p+1=arr[3]=4; outputs 234.
व्याख्या (हिन्दी) p arr[2]=3; की ओर इंगित करता है; p-1=arr[1]=2; p+1=arr[3]=4; आउटपुट 234.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1017

EN + हिं
GB The output of: string s="Hello World"; istringstream iss(s); string word; vector words; while(iss>>word)words.push_back(word); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो वर्ल्ड'; आईस्ट्रिंगस्ट्रीम जारी है; स्ट्रिंग शब्द; सदिश शब्द; जबकि(iss>>शब्द)शब्द.push_back(शब्द); अदालत
2Hello 2नमस्कार
2World 2विश्व
1Hello 1हैलो
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Two words: Hello and World; size=2, words[0]=Hello.
व्याख्या (हिन्दी) दो शब्द: हेलो और वर्ल्ड; आकार=2, शब्द[0]=हैलो।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1018

EN + हिं Medium
GB C++ is best described as which type of programming language?
IN C++ को किस प्रकार की प्रोग्रामिंग भाषा के रूप में सबसे अच्छा वर्णित किया गया है?
Pure OOP like Java जावा की तरह शुद्ध OOP
Compiled, statically-typed, multi-paradigm language supporting OOP, generic, and procedural programming OOP, सामान्य और प्रक्रियात्मक प्रोग्रामिंग का समर्थन करने वाली संकलित, स्थिर रूप से टाइप की गई, बहु-प्रतिमान भाषा
Interpreted like Python पायथन की तरह व्याख्या की गई
Functional only like Haskell केवल हास्केल की तरह कार्यात्मक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++: compiled, static typing, multi-paradigm: OOP + generic + procedural + some functional.
व्याख्या (हिन्दी) सी++: संकलित, स्थिर टाइपिंग, बहु-प्रतिमान: ओओपी + सामान्य + प्रक्रियात्मक + कुछ कार्यात्मक।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।