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 346

EN + हिं
GB What is the output: auto curry=[](int a){return [a](int b){return a+b;};};cout<
IN आउटपुट क्या है: auto curry=[](int a){return [a](int b){return a+b;};};cout
12 12
7 7
3 3
4 4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) curry(3) returns lambda that adds 3; called with 4: 3+4=7.
व्याख्या (हिन्दी) करी(3) लैम्ब्डा लौटाता है जो 3 जोड़ता है; 4:3+4=7 के साथ बुलाया गया।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 347

EN + हिं Easy
GB What is currying in functional programming?
IN कार्यात्मक प्रोग्रामिंग में करींग क्या है?
Merging functions कार्यों का विलय
Transforming multi-argument function into sequence of single-argument functions बहु-तर्क फ़ंक्शन को एकल-तर्क कार्यों के अनुक्रम में बदलना
Recursion pattern प्रत्यावर्तन पैटर्न
Template pattern टेम्पलेट पैटर्न
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Currying: f(a,b) becomes f(a)(b).
व्याख्या (हिन्दी) करी: f(a,b) f(a)(b) बन जाता है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है — difficulty level "Easy", और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 348

EN + हिं
GB The output of: vector v={1,2,3,4,5}; auto it=partition(v.begin(),v.end(),[](int x){return x%2==0;}); cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; ऑटो आईटी=विभाजन(v.begin(),v.end(),[](int x){रिटर्न x%2==0;}); अदालत
2 2
3 3
4 4
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Even elements {2,4} moved to front; partition point at index 2.
व्याख्या (हिन्दी) यहां तक ​​कि तत्व {2,4} भी सामने चले गए; सूचकांक 2 पर विभाजन बिंदु।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 349

EN + हिं
GB The output of: vector v={1,2,3,4,5}; rotate(v.begin(),v.begin()+3,v.end()); for(auto x:v)cout<
IN का आउटपुट: वेक्टर v={1,2,3,4,5}; रोटेट(v.begin(),v.begin()+3,v.end()); for(ऑटो x:v)cout
45123 45123
12345 12345
34512 34512
54321 54321
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Rotate left by 3: {4,5,1,2,3}.
व्याख्या (हिन्दी) 3 से बाएँ घुमाएँ: {4,5,1,2,3}।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 350

EN + हिं
GB The output of: int arr[]={3,1,4,1,5}; cout<<*max_element(arr,arr+5)<<" "<<*min_element(arr,arr+5);
IN इसका आउटपुट: int arr[]={3,1,4,1,5}; अदालत
5 1 5 1
3 1 3 1
4 1 4 1
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Max=5, Min=1.
व्याख्या (हिन्दी) अधिकतम=5, न्यूनतम=1.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 351

EN + हिं
GB The output of: int a=5,b=3; cout<
IN का आउटपुट: int a=5,b=3; अदालत
15 15
8 8
2 2
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Values: 5,3,8,15,2; max=15.
व्याख्या (हिन्दी) मान: 5,3,8,15,2; अधिकतम=15.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 352

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

Question 353

EN + हिं
GB The output of: cout<
IN का आउटपुट: कॉउट
1 1
-5 -5
10 10
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) -5 < 1 (lower bound); clamped to 1.
व्याख्या (हिन्दी) -5 <1 (निचली सीमा); 1 से जकड़ा हुआ।
🎯 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 354

EN + हिं
GB The output of: int a=3,b=5; cout<<(ab?a:b);
IN का आउटपुट: int a=3,b=5; अदालत
3 5 3 5
5 3 5 3
3 3 3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min(5)=3; max(5)=5.
व्याख्या (हिन्दी) मिनट(5)=3; अधिकतम(5)=5.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 355

EN + हिं
GB What is the output: int n=10; int bits=0; while(n){bits+=(n&1); n>>=1;} cout<
IN आउटपुट क्या है: int n=10; int बिट्स=0; जबकि(एन){बिट्स+=(एन&1); n>>=1;} कोउट
2 2
3 3
4 4
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10=1010 has 2 set bits.
व्याख्या (हिन्दी) 10=1010 में 2 सेट बिट हैं।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 356

EN + हिं
GB What is the output: cout<<(17>>1)<<" "<<(17<<1);
IN आउटपुट क्या है: cout1)
8 34 8 34
9 34 9 34
8 32 8 32
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 17>>1=8 (17/2); 17<<1=34 (17*2).
व्याख्या (हिन्दी) 17>>1=8 (17/2); 17
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में Data Structures and Algorithms ("Introduction to DSA" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 357

EN + हिं
GB The output of: int x=5; cout<<(x&-x);
IN का आउटपुट: int x=5; अदालत
1 1
5 5
-5 -5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x&-x extracts lowest set bit of 5(101): 1.
व्याख्या (हिन्दी) x&-x 5(101): 1 का न्यूनतम सेट बिट निकालता है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो Data Structures and Algorithms ("Introduction to DSA" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 358

EN + हिं Easy
GB What does x&-x compute?
IN x&-x क्या गणना करता है?
Negative of x x का ऋणात्मक
Lowest set bit of x x का न्यूनतम सेट बिट
All bits of x x के सभी बिट्स
XOR of x एक्स का एक्सओआर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x&-x isolates the rightmost set bit.
व्याख्या (हिन्दी) x&-x सबसे दाहिने सेट बिट को अलग करता है।
🎯 Exam Perspective
Data Structures and Algorithms ("Introduction to DSA" sub-topic) के इस प्रश्न को — difficulty level "Easy" कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 359

EN + हिं
GB What is the output: cout<<(__builtin_ctz(12));
IN आउटपुट क्या है: cout
2 2
3 3
4 4
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 12=1100; count trailing zeros = 2.
व्याख्या (हिन्दी) 12=1100; पिछले शून्यों की गिनती = 2.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms ("Introduction to DSA" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 360

EN + हिं Medium
GB __builtin_ctz computes:
IN __बिल्टिन_ctz गणना करता है:
Count total zeros कुल शून्य गिनें
Count trailing zero bits अनुगामी शून्य बिट्स की गणना करें
Count leading zeros अग्रणी शून्यों की गणना करें
Count set bits सेट बिट्स की गणना करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ctz = count trailing zeros (from LSB).
व्याख्या (हिन्दी) ctz = पिछले शून्यों की गिनती करें (एलएसबी से)।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms ("Introduction to DSA" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है — difficulty level "Medium"। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।