OOP Using C++ — MCQ Practice

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

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

Question 31

EN + हिं
GB What is the output: template T maxOf(T a,T b){return a>b?a:b;} cout<
IN आउटपुट क्या है: टेम्पलेट T maxOf(T a,T b){return a>b?a:b;} cout
72.5 72.5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
3 7 3 7
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) maxOf(3,7)=7, maxOf(2.5,1.5)=2.5. Output: 72.5.
व्याख्या (हिन्दी) maxOf(3,7)=7, maxOf(2.5,1.5)=2.5. आउटपुट: 72.5.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 32

EN + हिं
GB What is the output: template struct Pair{T a,b; Pair(T x,T y):a(x),b(y){} T sum(){return a+b;}}; Pair p(3,4); cout<
IN आउटपुट क्या है: टेम्पलेट स्ट्रक्चर पेयर{T a,b; जोड़ी(टी एक्स,टी वाई):ए(एक्स),बी(वाई){} टी योग(){रिटर्न ए+बी;}}; जोड़ी पी(3,4); अदालत
7 7
12 12
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3+4=7. Output: 7.
व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Templates" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 33

EN + हिं
GB What is the output: template auto add(T a,U b){return a+b;} cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो ऐड(टी ए,यू बी){रिटर्न ए+बी;} कॉउट
3.5 3.5
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int+double=3.5. Output: 3.5.
व्याख्या (हिन्दी) int+डबल=3.5. आउटपुट: 3.5.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 34

EN + हिं
GB What is the output: template void print(T v){cout<
IN आउटपुट क्या है: टेम्पलेट शून्य प्रिंट (टी वी) {काउट
1 A 3.14 1 ए 3.14
Compile error संकलन त्रुटि
Undefined अपरिभाषित
1A3 1ए3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Prints each with space. Output: 1 A 3.14.
व्याख्या (हिन्दी) प्रत्येक को स्थान के साथ प्रिंट करता है। आउटपुट: 1 ए 3.14.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 35

EN + हिं
GB What is the output: template struct Square{static const int v=N*N;}; cout<::v;
IN आउटपुट क्या है: टेम्पलेट स्ट्रक्चर स्क्वायर {static const int v=N*N;}; अदालत
49 49
7 7
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7*7=49. Output: 49.
व्याख्या (हिन्दी) 7*7=49. आउटपुट: 49.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Templates" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 36

EN + हिं
GB What is the output: template class Stack{vectorv; public: void push(T x){v.push_back(x);} T top(){return v.back();} int size(){return v.size();}}; Stack s; s.push(1);s.push(2);s.push(3); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास स्टैक{वेक्टरव; सार्वजनिक: शून्य पुश(T x){v.push_back(x);} T टॉप(){रिटर्न v.बैक();} int आकार(){रिटर्न v.आकार();}}; ढेर एस; एस.पुश(1);एस.पुश(2);एस.पुश(3); अदालत
33 33
13 13
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) top=3, size=3. Output: 33.
व्याख्या (हिन्दी) शीर्ष=3, आकार=3. आउटपुट: 33.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Templates" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 37

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

Question 38

EN + हिं
GB What is the output: template T clamp(T v,T lo,T hi){return vhi?hi:v;} cout<
IN आउटपुट क्या है: टेम्पलेट टी क्लैंप(टी वी,टी लो,टी हाय){रिटर्न वीएचआई?हाय:वी;} कॉउट
5101 5101
Compile error संकलन त्रुटि
Undefined अपरिभाषित
5 10 1 5 10 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) clamp(5,1,10)=5, clamp(15,1,10)=10, clamp(-5,1,10)=1. Output: 5101.
व्याख्या (हिन्दी) क्लैंप(5,1,10)=5, क्लैंप(15,1,10)=10, क्लैंप(-5,1,10)=1। आउटपुट: 5101.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Templates" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 39

EN + हिं
GB What is the output: template bool isNull(T* p){return p==nullptr;} int x=5; cout<
IN आउटपुट क्या है: टेम्पलेट बूल isNull(T* p){return p==nullptr;} int x=5; अदालत
01 01
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &x!=null=0; nullptr=1. Output: 01.
व्याख्या (हिन्दी) &x!=शून्य=0; nullptr=1. आउटपुट: 01.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 40

EN + हिं
GB What is the output: template struct Remove{using type=T;}; template struct Remove{using type=T;}; cout<::type,int>;
IN आउटपुट क्या है: टेम्पलेट संरचना निकालें{प्रकार=टी का उपयोग करके;}; टेम्प्लेट संरचना निकालें{प्रकार=टी का उपयोग करके;}; अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove::type=int. is_same=true=1. Output: 1.
व्याख्या (हिन्दी) हटाएँ::प्रकार=int. वही=सत्य=1 है. आउटपुट: 1.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 41

EN + हिं
GB What is the output: template T sumArr(T* arr,int n){T s{}; for(int i=0;i
IN आउटपुट क्या है: टेम्पलेट T sumArr(T* arr,int n){T s{}; for(int i=0;i
15 15
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Templates" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 42

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

Question 43

EN + हिं
GB What is the output: template T power(T base,int exp){return exp?base*power(base,exp-1):1;} cout<
IN आउटपुट क्या है: टेम्पलेट T पॉवर(T बेस,int exp){रिटर्न exp?base*power(base,exp-1):1;} cout
1024 1024
512 512
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2^10=1024. Output: 1024.
व्याख्या (हिन्दी) 2^10=1024. आउटपुट: 1024.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 44

EN + हिं
GB What is the output: template struct GCD{static const int v=GCD::v;}; template struct GCD{static const int v=N;}; cout<::v;
IN आउटपुट क्या है: टेम्पलेट struct GCD{static const int v=GCD::v;}; टेम्पलेट संरचना GCD{static const int v=N;}; अदालत
6 6
18 18
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) GCD(48,18)=6. Output: 6.
व्याख्या (हिन्दी) जीसीडी(48,18)=6. आउटपुट: 6.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Templates" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 45

EN + हिं
GB What is the output: template void swap2(T& a,T& b){T t=a;a=b;b=t;} int x=3,y=7; swap2(x,y); cout<
IN आउटपुट क्या है: टेम्पलेट void swim2(T& a,T& b){T t=a;a=b;b=t;} int x=3,y=7; स्वैप2(एक्स,वाई); अदालत
73 73
37 37
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=7,y=3. Output: 73.
व्याख्या (हिन्दी) x=7,y=3. आउटपुट: 73.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।