OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye.

📚 1915 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1915 questions

Question 1906

EN + हिं
GB What is the output: template T arraySum(const T(&arr)[N]){T s=T{};for(auto x:arr)s+=x;return s;} int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: टेम्पलेट T arraySum(const T(&arr)[N]){T s=T{};for(auto x:arr)s+=x;return s;} int a[]={1,2,3,4,5}; अदालत
15 15
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) N deduced=5. Sum=15. Output: 15.
व्याख्या (हिन्दी) एन घटा=5. योग=15. आउटपुट: 15.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1907

EN + हिं
GB What is the output: template auto makeShared2(auto&&...args){return make_shared(forward(args)...);} auto p=makeShared2>(5,"hi"); cout<first<second;
IN आउटपुट क्या है: टेम्पलेट ऑटो मेकशेयर्ड2(ऑटो&&...आर्ग्स){रिटर्न मेक_शेयर्ड(फॉरवर्ड(आर्ग्स)...);} ऑटो पी=मेकशेयर्ड2(5,"हाय"); अदालत
5hi 5हाय
Compile error संकलन त्रुटि
Undefined अपरिभाषित
5 hi 5 नमस्ते
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p->first=5, p->second=hi. Output: 5hi.
व्याख्या (हिन्दी) p->पहला=5, p->दूसरा=हाय। आउटपुट: 5हाय.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1908

EN + हिं
GB What is the output: template struct Traits{static constexpr bool isNum=false; static constexpr int bytes=sizeof(T);}; template<> struct Traits{static constexpr bool isNum=true; static constexpr int bytes=4;}; cout<::isNum<::bytes<::isNum;
IN आउटपुट क्या है: टेम्प्लेट स्ट्रक्चर ट्रैट्स {स्टेटिक कॉन्स्टेक्सपीआर बूल isNum=false; static constexpr int बाइट्स=sizeof(T);}; टेम्प्लेट संरचना लक्षण {static constexpr bool isNum=true; static constexpr int बाइट्स=4;}; अदालत
140 140
041 041
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) isNum=1, bytes=4, Traits::isNum=0. Output: 140.
व्याख्या (हिन्दी) isNum=1, बाइट्स=4, लक्षण::isNum=0. आउटपुट: 140.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1909

EN + हिं
GB What is the output: template bool isInRange(T v,T lo,T hi){return v>=lo&&v<=hi;} cout<
IN आउटपुट क्या है: टेम्पलेट बूल isInRange(T v,T lo,T hi){return v>=lo&&v
101 101
010 010
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 in range=1; 15 not=0; 1 in range=1. Output: 101.
व्याख्या (हिन्दी) रेंज में 5=1; 15 नहीं=0; रेंज में 1=1. आउटपुट: 101.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1910

EN + हिं
GB What is the output: template vector range_(T start,T stop,T step=T(1)){vectorv;for(T i=start;i
IN आउटपुट क्या है: टेम्प्लेट वेक्टर रेंज_(टी स्टार्ट, टी स्टॉप, टी स्टेप=टी(1)){वेक्टरव;फॉर(टी आई=स्टार्ट;आई
37 37
39 39
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,4,7: size=3, back=7. Output: 37.
व्याख्या (हिन्दी) 1,4,7: आकार=3, पिछला=7। आउटपुट: 37.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1911

EN + हिं
GB What is the output: template auto applyAll(F f){if constexpr(sizeof...(Ns)>0)return f(N)+applyAll(f);else return f(N);} cout<([](int x){return x*x;});
IN आउटपुट क्या है: टेम्पलेट ऑटो अप्लाईऑल(एफ एफ){इफ कॉन्स्टेक्सप्र(साइजऑफ...(एनएस)>0)रिटर्न एफ(एन)+अप्लाईऑल(एफ);एल्स रिटर्न एफ(एन);} कॉउट
14 14
Compile error संकलन त्रुटि
Undefined अपरिभाषित
1 4 9 1 4 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+4+9=14. Output: 14.
व्याख्या (हिन्दी) 1+4+9=14. आउटपुट: 14.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1912

EN + हिं
GB What is the output: template class TypeInfo{public:static string name(){return "unknown";}}; template<> class TypeInfo{public:static string name(){return "int";}}; template<> class TypeInfo{public:static string name(){return "double";}}; cout<::name()<<' '<::name();
IN What is the output: template class TypeInfo{public:static string name(){return "unknown";}}; template class TypeInfo{public:static string name(){return "int";}}; template class TypeInfo{public:static string name(){return "double";}}; अदालत
int unknown पूर्णतया अज्ञात
int double इंट डबल
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int=int; float=unknown. Output: int unknown.
व्याख्या (हिन्दी) int=int; तैरना=अज्ञात. आउटपुट: पूर्णांक अज्ञात.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1913

EN + हिं
GB What is the output: template struct NthType{using type=typename NthType::type;}; template struct NthType<0,T,Ts...>{using type=T;}; cout<::type,double>;
IN What is the output: template struct NthType{using type=typename NthType::type;}; टेम्पलेट संरचना NthType{उपयोग प्रकार=T;}; अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) NthType<1,...>=double. is_same=1. Output: 1.
व्याख्या (हिन्दी) NthType=डबल. समान=1 है. आउटपुट: 1.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1914

EN + हिं
GB What is the output: template auto zip_(vectora,vectorb){vector>r;for(int i=0;i({1,2,3},{10,20,30}); int s=0;for(auto[x,y]:r)s+=x*y; cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो zip_(vectora,vectorb){vectorr;for(int i=0;i
140 140
60 60
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*10+2*20+3*30=140. Output: 140.
व्याख्या (हिन्दी) 1*10+2*20+3*30=140. आउटपुट: 140.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1915

EN + हिं
GB What is the output: template struct EnableType{}; template<> struct EnableType{using type=int;}; EnableType::type x=42; cout<
IN आउटपुट क्या है: टेम्पलेट संरचना EnableType{}; टेम्पलेट संरचना EnableType{using type=int;}; EnableType::type x=42; अदालत
42 42
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) EnableType::type=int. x=42. Output: 42.
व्याख्या (हिन्दी) EnableType::type=int. एक्स=42. आउटपुट: 42.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।