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 541

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

Question 542

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

Question 543

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
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है — difficulty level "Easy"। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 544

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

Question 545

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 category का है — difficulty level "Medium", और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 546

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

Question 547

EN + हिं
GB What is the output: auto [mn,mx]=minmax({5,3,8,1,9,2}); cout<
IN आउटपुट क्या है: ऑटो [एमएन,एमएक्स]=मिनमैक्स({5,3,8,1,9,2}); अदालत
1 9 1 9
5 9 5 9
1 5 1 5
3 8 3 8
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) minmax with structured binding: min=1, max=9.
व्याख्या (हिन्दी) संरचित बाइंडिंग के साथ न्यूनतम अधिकतम: न्यूनतम=1, अधिकतम=9।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 548

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

Question 549

EN + हिं
GB The output of: string s="abcde"; cout<
IN इसका आउटपुट: स्ट्रिंग s='abcde'; अदालत
cde सीडीई
abc एबीसी
bcd बीसीडी
ede ede
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=5, size-3=2; substr from index 2 = "cde".
व्याख्या (हिन्दी) आकार=5, आकार-3=2; इंडेक्स 2 से सबस्ट्र = "सीडीई"।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 550

EN + हिं
GB The output of: string s="Hello, World!"; cout<
IN इसका आउटपुट: स्ट्रिंग s='हैलो, वर्ल्ड!'; अदालत
10 10
2 2
3 3
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) rfind finds last occurrence of "l" at index 10.
व्याख्या (हिन्दी) rfind को सूचकांक 10 पर "l" की अंतिम घटना मिलती है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 551

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 category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 552

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 की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 553

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: (3) at index 0; *res=1.
व्याख्या (हिन्दी) आसन्न जहां b=a+2: (3) सूचकांक 0 पर; *res=1.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 554

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

Question 555

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}; reverse(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 CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।