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 616

EN + हिं
GB The output of: int n=5; string s(n,*); cout<
IN का आउटपुट: int n=5; स्ट्रिंग एस(एन,*); अदालत
***** *****
n एन
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) string(5,*) creates "****".
व्याख्या (हिन्दी) स्ट्रिंग(5,*) "****" बनाता है।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 617

EN + हिं
GB The output of: string s="Hello"; s.insert(5," World"); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो'; s.insert(5," विश्व"); अदालत
Hello World हैलो वर्ल्ड
WorldHello विश्वनमस्कार
HelloWorld हैलो वर्ल्ड
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Insert " World" at position 5 (end of "Hello").
व्याख्या (हिन्दी) स्थिति 5 ("हैलो" के अंत में) "वर्ल्ड" डालें।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 618

EN + हिं
GB The output of: string s="Hello World"; s.replace(6,5,"C++"); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो वर्ल्ड'; s.replace(6,5,"C++"); अदालत
Hello C++ नमस्ते सी++
Hello World हैलो वर्ल्ड
C++ World सी++ विश्व
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Replace 5 chars starting at 6 ("World") with "C++".
व्याख्या (हिन्दी) 6 ("विश्व") से शुरू होने वाले 5 वर्णों को "C++" से बदलें।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 619

EN + हिं Easy
GB What does string::npos equal?
IN स्ट्रिंग::npos किसके बराबर है?
-1 as size_t (maximum size_t value) -1 size_t के रूप में (अधिकतम size_t मान)
NULL व्यर्थ
Empty string खाली स्ट्रिंग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) npos = (size_t)-1 = maximum value of size_t.
व्याख्या (हिन्दी) npos = (size_t)-1 = size_t का अधिकतम मान।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल — difficulty level "Easy" उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 620

EN + हिं
GB The output of: string s="hello"; for(auto &c:s) c=toupper(c); cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो'; for(auto &c:s) c=toupper(c); अदालत
hello नमस्ते
HELLO नमस्ते
Hello नमस्ते
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) toupper converts each char; auto& modifies in place.
व्याख्या (हिन्दी) टॉपर प्रत्येक चार को परिवर्तित करता है; स्वत:&स्थान में संशोधित होता है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 621

EN + हिं
GB The output of: string s="12345"; int n=stoi(s); cout<
IN इसका आउटपुट: स्ट्रिंग s='12345'; int n=stoi(s); अदालत
1234512345 1234512345
24690 24690
12345 12345
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) stoi converts to 12345; 12345*2=24690.
व्याख्या (हिन्दी) Stoi 12345 में परिवर्तित हो जाता है; 12345*2=24690.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 622

EN + हिं
GB The output of: int n=42; string s=to_string(n); cout<
IN का आउटपुट: int n=42; स्ट्रिंग s=to_string(n); अदालत
2 2
42 42
1 1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) "42" has 2 characters.
व्याख्या (हिन्दी) "42" में 2 अक्षर हैं।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 623

EN + हिं
GB The output of: vector v={"Hello","World"}; string result=accumulate(v.begin(),v.end(),string("")); cout<
IN The output of: vector v={"Hello","World"}; स्ट्रिंग परिणाम=संचय(v.begin(),v.end(),string("")); अदालत
HelloWorld हैलो वर्ल्ड
Hello World हैलो वर्ल्ड
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Accumulate with string: "" + "Hello" + "World" = "HelloWorld".
व्याख्या (हिन्दी) स्ट्रिंग के साथ जमा करें: "" + "हैलो" + "वर्ल्ड" = "हैलोवर्ल्ड"।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 624

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

Question 625

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

Question 626

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

Question 627

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

Question 628

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

Question 629

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

Question 630

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