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 916

EN + हिं
GB The output of: auto f=[i=0]()mutable{return i++;}; cout<
IN इसका आउटपुट: auto f=[i=0]()mutable{return i++;}; अदालत
000 000
012 012
123 123
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Mutable lambda with init capture; i goes 0,1,2.
व्याख्या (हिन्दी) इनिट कैप्चर के साथ म्यूटेबल लैम्ब्डा; मैं 0,1,2 जाता हूँ।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 917

EN + हिं
GB What is the output: vector v(10); iota(v.begin(),v.end(),1); auto sum=reduce(execution::par,v.begin(),v.end()); cout<
IN आउटपुट क्या है: वेक्टर v(10); iota(v.begin(),v.end(),1); स्वत: योग=कम(निष्पादन::बराबर,v.begin(),v.end()); अदालत
55 55
45 45
50 50
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+...+10=55 (parallel reduce).
व्याख्या (हिन्दी) 1+2+...+10=55 (समानांतर घटाएँ)।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 918

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

Question 919

EN + हिं
GB The output of: namespace A{int x=1;} namespace B{int x=2;} cout<
IN इसका आउटपुट: नेमस्पेस A{int x=1;} नेमस्पेस B{int x=2;} कोउट
12 12
21 21
11 11
22 22
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A::x=1, B::x=2.
व्याख्या (हिन्दी) ए::x=1, बी::x=2.
🎯 Exam Perspective
Data Structures and Algorithms से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 920

EN + हिं
GB The output of: namespace A{void f(){cout<<"A";}} namespace B{void f(){cout<<"B";}} using namespace A; f();
IN इसका आउटपुट: नेमस्पेस A{void f(){cout
A
B बी
Error गलती
AB अब
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) using namespace A brings f into scope; calls A::f.
व्याख्या (हिन्दी) नेमस्पेस ए का उपयोग एफ को दायरे में लाता है; ए::एफ को कॉल करता है।
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 921

EN + हिं
GB What is the output: template struct Factorial{enum{value=N*Factorial::value};}; template<> struct Factorial<0>{enum{value=1};}; cout<::value;
IN आउटपुट क्या है: टेम्पलेट संरचना Factorial{enum{value=N*Facttorial::value};}; टेम्प्लेट संरचना फ़ैक्टोरियल{enum{value=1};}; अदालत
5 5
120 120
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) TMP factorial: 5!=120 computed at compile time.
व्याख्या (हिन्दी) टीएमपी फैक्टोरियल: 5!=120 संकलन समय पर गणना की गई।
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 922

EN + हिं Medium
GB Template metaprogramming Fibonacci: Fib<7>::value =
IN टेम्प्लेट मेटाप्रोग्रामिंग फाइबोनैचि: Fib::value =
13 13
21 21
8 8
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) TMP Fibonacci: F(7)=13.
व्याख्या (हिन्दी) टीएमपी फाइबोनैचि: एफ(7)=13।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को — difficulty level "Medium" कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 923

EN + हिं
GB What is the output: template struct TypeName{static const char* get(){return "unknown";}}; template<> struct TypeName{static const char* get(){return "int";}}; cout<::get();
IN आउटपुट क्या है: टेम्प्लेट स्ट्रक्चर टाइपनेम {स्टैटिक कॉन्स चार * गेट () {रिटर्न "अज्ञात";}}; टेम्प्लेट संरचना प्रकारनाम{स्थिर स्थिरांक चार* प्राप्त(){वापसी "int";}}; अदालत
unknown अज्ञात
int int यहाँ
Error गलती
T टी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Template specialization for int returns "int".
व्याख्या (हिन्दी) इंट के लिए टेम्पलेट विशेषज्ञता "इंट" लौटाती है।
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 924

EN + हिं
GB The output of: int a=1,b=2; auto [x,y]={a,b}; cout<
IN का आउटपुट: int a=1,b=2; ऑटो [x,y]={a,b}; अदालत
12 12
21 21
Error गलती
Depends निर्भर करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Structured binding: x=1, y=2.
व्याख्या (हिन्दी) संरचित बाइंडिंग: x=1, y=2.
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 925

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

Question 926

EN + हिं
GB The output of: optional o; cout<
IN का आउटपुट: वैकल्पिक ओ; अदालत
99 99
Error गलती
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) o is empty; value_or returns 99.
व्याख्या (हिन्दी) ओ खाली है; वैल्यू_ऑर 99 लौटाता है।
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में Data Structures and Algorithms से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 927

EN + हिं
GB The output of: variant v=42; cout<(v);
IN का आउटपुट: वैरिएंट v=42; अदालत
42 42
Error गलती
String डोरी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v holds int 42; get extracts it.
व्याख्या (हिन्दी) v int 42 रखता है; get इसे निकालता है।
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो Data Structures and Algorithms का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 928

EN + हिं
GB The output of: variant v=3.14; cout<(v);
IN का आउटपुट: वैरिएंट v=3.14; अदालत
3 3
3.14 3.14
Error गलती
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v holds double 3.14; get extracts it.
व्याख्या (हिन्दी) v डबल 3.14 रखता है; get इसे निकालता है।
🎯 Exam Perspective
Data Structures and Algorithms के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 929

EN + हिं
GB The output of: any a=42; cout<(a);
IN का आउटपुट: कोई भी a=42; अदालत
Error गलती
42 42
4 4
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::any stores 42 as int; any_cast extracts 42.
व्याख्या (हिन्दी) std::कोई भी स्टोर 42 int के रूप में; Any_cast अर्क 42.
🎯 Exam Perspective
यह सवाल Data Structures and Algorithms category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 930

EN + हिं
GB The output of: any a=string("hello"); cout<(a);
IN इसका आउटपुट: कोई भी a=string('hello'); अदालत
Error गलती
hello नमस्ते
string डोरी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) any stores string; any_cast extracts "hello".
व्याख्या (हिन्दी) कोई भी स्टोर स्ट्रिंग; Any_cast "हैलो" निकालता है।
🎯 Exam Perspective
यह प्रश्न Data Structures and Algorithms की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।