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 646

EN + हिं
GB The output of: auto v=vector{3,1,4,1,5,9,2,6}; ranges::sort(v); cout<
IN का आउटपुट: ऑटो v=वेक्टर{3,1,4,1,5,9,2,6}; श्रेणियाँ::सॉर्ट(v); अदालत
19 19
18 18
91 91
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: {1,1,2,3,4,5,6,9}; v[0]=1, v[7]=9.
व्याख्या (हिन्दी) क्रमबद्ध: {1,1,2,3,4,5,6,9}; v[0]=1, v[7]=9.
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 647

EN + हिं
GB The output of: auto r=views::iota(1)|views::take(5); for(auto x:r)cout<
IN का आउटपुट: ऑटो r=views::iota(1)|views::take(5); for(auto x:r)cout
12345 12345
01234 01234
5 5
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) iota from 1 taking 5: 1,2,3,4,5.
व्याख्या (हिन्दी) 1 से आईओटीए 5 लेते हुए: 1,2,3,4,5।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 648

EN + हिं
GB The output of: int n=100; auto isprime=[](int n){for(int i=2;i*i<=n;i++) if(n%i==0)return false; return n>1;}; auto primes=views::iota(2)|views::filter(isprime)|views::take(5); cout<
IN इसका आउटपुट: int n=100; ऑटो प्राइम=[](int n){for(int i=2;i*i1;}; ऑटो प्राइम्स=व्यूज::आईओटा(2)|व्यूज::फिल्टर(आईएसप्राइम)|व्यूज::टेक(5); कॉउट
5 5
10 10
4 4
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First 5 primes: 2,3,5,7,11; distance=5.
व्याख्या (हिन्दी) प्रथम 5 अभाज्य संख्याएँ: 2,3,5,7,11; दूरी=5.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 649

EN + हिं
GB The output of: expected e=42; cout<
IN का आउटपुट: अपेक्षित e=42; अदालत
Error गलती
42 42
string डोरी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) expected holds int 42; value() returns 42.
व्याख्या (हिन्दी) अपेक्षित होल्ड int 42; वैल्यू() 42 लौटाता है।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 650

EN + हिं
GB The output of: expected e=unexpected("error"); cout<
IN का आउटपुट: अपेक्षित ई=अप्रत्याशित('त्रुटि'); अदालत
1 1
Error गलती
string डोरी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) unexpected sets error state; has_value()=false=0.
व्याख्या (हिन्दी) अप्रत्याशित सेट त्रुटि स्थिति; has_value()=गलत=0.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 651

EN + हिं
GB What is the output: int x=5; auto f=[x=move(x)](){return x;}; cout<
IN आउटपुट क्या है: int x=5; ऑटो f=[x=move(x)](){रिटर्न x;}; अदालत
55 55
50 50
05 05
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Move x into lambda (x=5 copied for int); original x becomes indeterminate; f()=5, x indeterminate.
व्याख्या (हिन्दी) x को लैम्ब्डा में ले जाएँ (x=5 int के लिए कॉपी किया गया); मूल x अनिश्चित हो जाता है; f()=5, x अनिश्चित।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 652

EN + हिं
GB The output of: string s1="Hello"; string s2=move(s1); cout<
IN इसका आउटपुट: स्ट्रिंग s1='हैलो'; स्ट्रिंग s2=move(s1); अदालत
5 5 5 5
0 5 0 5
5 0 5 0
0 0 0 0
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After move, s1 is empty (size 0); s2 has content (size 5).
व्याख्या (हिन्दी) स्थानांतरित होने के बाद, s1 खाली है (आकार 0); s2 में सामग्री (आकार 5) है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 653

EN + हिं
GB The output of: vector v1={1,2,3}; vector v2=move(v1); cout<
IN का आउटपुट: वेक्टर v1={1,2,3}; वेक्टर v2=चाल(v1); अदालत
3 3 3 3
0 3 0 3
3 0 3 0
0 0 0 0
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After move, v1 is empty; v2 has 3 elements.
व्याख्या (हिन्दी) स्थानांतरित होने के बाद, v1 खाली है; v2 में 3 तत्व हैं।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 654

EN + हिं
GB The output of: unique_ptr p=make_unique(42); unique_ptr q=move(p); cout<<(p?"has":"null")<<(q?"has":"null");
IN का आउटपुट:unique_ptr p=make_unique(42); अद्वितीय_पीटीआर क्यू=मूव(पी); अदालत
hashas है है
nullhas नलहास
hasnull शून्य
nullnull शून्य-शून्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After move, p is null; q has the value.
व्याख्या (हिन्दी) चाल के बाद, p शून्य है; q का मान है.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 655

EN + हिं
GB The output of: shared_ptr sp=make_shared(10); { shared_ptr sp2=sp; cout<
IN इसका आउटपुट: share_ptr sp=make_shared(10); {shared_ptr sp2=sp; अदालत
2 1 2 1
1 1 11
2 2 2 2
1 2 1 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Inside block: 2 owners; after block sp2 destroyed: 1 owner.
व्याख्या (हिन्दी) अंदर का ब्लॉक: 2 मालिक; ब्लॉक एसपी2 नष्ट होने के बाद: 1 मालिक।
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 656

EN + हिं
GB What is the output: int x=5; decltype(x) y=10; cout<
IN आउटपुट क्या है: int x=5; घोषणापत्र(x) y=10; अदालत
5 5
10 10
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) decltype(x) = int; y=10.
व्याख्या (हिन्दी) decltype(x) = int; y=10.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 657

EN + हिं
GB The output of: auto f(int x,int y)->int{return x+y;} cout<
IN इसका आउटपुट: auto f(int x,int y)->int{return x+y;} cout
12 12
7 7
3 3
4 4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Trailing return type; 3+4=7.
व्याख्या (हिन्दी) अनुगामी वापसी प्रकार; 3+4=7.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 658

EN + हिं
GB The output of: int x=10; int y=[&]{return x*2;}(); cout<
IN का आउटपुट: int x=10; int y=[&]{रिटर्न x*2;}(); अदालत
10 10
20 20
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) IIFE captures x=10; returns 20; y=20.
व्याख्या (हिन्दी) IIFE x=10 को कैप्चर करता है; रिटर्न 20; y=20.
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 659

EN + हिं
GB The output of: constexpr auto factorial=[](auto self,int n)->int{return n<=1?1:n*self(self,n-1);}; cout<
IN इसका आउटपुट: constexpr auto Factorial=[](auto self,int n)->int{return n
720 720
6 6
120 120
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Recursive lambda via self-reference; 6!=720.
व्याख्या (हिन्दी) स्व-संदर्भ के माध्यम से पुनरावर्ती लैम्ब्डा; 6!=720.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 660

EN + हिं
GB The output of: struct A{int x; auto getX(){return x;}}; A a{42}; cout<
IN का आउटपुट: struct A{int x; ऑटो getX(){रिटर्न x;}}; ए ए{42}; अदालत
Error गलती
42 42
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto deduces int; returns x=42.
व्याख्या (हिन्दी) ऑटो int घटाता है; x=42 लौटाता है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।