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 91

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

Question 92

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

Question 93

EN + हिं
GB What is the output: template auto makeRange(T start,T end,T step){vectorv;for(T i=start;i
IN आउटपुट क्या है: टेम्पलेट ऑटो मेकरेंज (टी स्टार्ट, टी एंड, टी स्टेप) {वेक्टरव; फॉर (टी आई = स्टार्ट; आई)
49 49
Compile error संकलन त्रुटि
Undefined अपरिभाषित
4 9 4 9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0,3,6,9: 4 elements. back=9. Output: 49.
व्याख्या (हिन्दी) 0,3,6,9: 4 तत्व। वापस=9. आउटपुट: 49.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 94

EN + हिं
GB What is the output: template bool isPalindrome(vectorv){return equal(v.begin(),v.begin()+v.size()/2,v.rbegin());} cout<({1,2,3,2,1})<({1,2,3});
IN आउटपुट क्या है: टेम्पलेट बूल isPalindrome(vectorv){returnqual(v.begin(),v.begin()+v.size()/2,v.rbegin());} cout
10 10
11 11
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First is palindrome=1; second not=0. Output: 10.
व्याख्या (हिन्दी) पहला है पैलिन्ड्रोम=1; दूसरा नहीं=0. आउटपुट: 10.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 95

EN + हिं
GB What is the output: template T fromBinary(string s){T n=0;for(char c:s) n=n*2+(c-'0');return n;} cout<("1010");
IN आउटपुट क्या है: टेम्प्लेट T fromBinary(string s){T n=0;for(char c:s) n=n*2+(c-'0');return n;} cout
10 10
4 4
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1010 binary=10. Output: 10.
व्याख्या (हिन्दी) 1010 बाइनरी=10. आउटपुट: 10.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Templates" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 96

EN + हिं
GB What is the output: template class Bimap{mapfwd;mapbwd; public:void insert(K k,V v){fwd[k]=v;bwd[v]=k;} V get(K k){return fwd[k];} K rget(V v){return bwd[v];}}; Bimapm; m.insert(1,"one"); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास Bimap{mapfwd;mapbwd; सार्वजनिक: शून्य सम्मिलित करें (के के, वी वी) {एफडब्ल्यूडी [के] = वी; बीडब्ल्यूडी [वी] = के;} वी प्राप्त करें (के के) {रिटर्न एफडब्ल्यूडी [के];} के आरगेट (वी वी) {रिटर्न बीडब्ल्यूडी [वी];}}; बिमापम; m.insert(1,'एक'); अदालत
one1 one1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
1one 1एक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) get(1)=one; rget(one)=1. Output: one1.
व्याख्या (हिन्दी) प्राप्त करें(1)=एक; rget(एक)=1. आउटपुट: one1.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Templates" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 97

EN + हिं
GB What is the output: template struct NTuple{arrayd; NTuple(initializer_listil){copy(il.begin(),il.begin()+N,d.begin());} T& get(size_t i){return d[i];}}; NTuple<3,int>t={1,2,3}; cout<
IN आउटपुट क्या है: टेम्पलेट struct Ntuple{arrayd; NTuple(initializer_listil){copy(il.begin(),il.begin()+N,d.begin());} T& get(size_t i){return d[i];}}; NTuplet={1,2,3}; अदालत
4 4
6 6
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+3=4. Output: 4.
व्याख्या (हिन्दी) 1+3=4. आउटपुट: 4.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 98

EN + हिं
GB What is the output: template T sum(T* arr,int n){T s=T{};for(int i=0;i
IN आउटपुट क्या है: टेम्पलेट T sum(T* arr,int n){T s=T{};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
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Templates" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 99

EN + हिं
GB What is the output: template bool contains(vectorv,T x){return find(v.begin(),v.end(),x)!=v.end();} cout<({1,2,3,4,5},3)<({1,2,3},9);
IN आउटपुट क्या है: टेम्प्लेट बूल में शामिल है (वेक्टरv,T x) {रिटर्न फाइंड (v.begin(),v.end(),x)!=v.end();} कॉउट
10 10
11 11
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3 found=1; 9 not found=0. Output: 10.
व्याख्या (हिन्दी) 3 पाया=1; 9 नहीं मिला=0. आउटपुट: 10.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 100

EN + हिं
GB What is the output: template T median(vectorv){sort(v.begin(),v.end());return v[v.size()/2];} cout<({5,3,8,1,4});
IN आउटपुट क्या है: टेम्पलेट T माध्यिका(वेक्टरv){sort(v.begin(),v.end());रिटर्न v[v.size()/2];} कोउट
4 4
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,3,4,5,8. Middle=4. Output: 4.
व्याख्या (हिन्दी) क्रमबद्ध: 1,3,4,5,8. मध्य=4. आउटपुट: 4.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 101

EN + हिं
GB What is the output: template struct Arr{T d[N]; int size(){return N;} T& operator[](int i){return d[i];}}; Arra{}; a[0]=1;a[1]=2;a[2]=3; cout<
IN आउटपुट क्या है: टेम्पलेट संरचना Arr{T d[N]; int आकार(){रिटर्न N;} T& ऑपरेटर[](int i){रिटर्न d[i];}}; आरा{}; a[0]=1;a[1]=2;a[2]=3; अदालत
4 4
6 6
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+3=4. Output: 4.
व्याख्या (हिन्दी) 1+3=4. आउटपुट: 4.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Templates" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 102

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

Question 103

EN + हिं
GB What is the output: template string join(string sep,Args... args){ostringstream oss;bool first=true;((oss<<(first?first=false,string{}:sep)<
IN आउटपुट क्या है: टेम्प्लेट स्ट्रिंग जॉइन(स्ट्रिंग sep,Args...args){ostringstream oss;boolfirst=true;((oss
1-2-3 1-2-3
123 123
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Join with '-': 1-2-3. Output: 1-2-3.
व्याख्या (हिन्दी) '-' से जुड़ें: 1-2-3. आउटपुट: 1-2-3.
🎯 Exam Perspective
OOP Using C++ ("Templates" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 104

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

Question 105

EN + हिं
GB What is the output: template auto makeVector(int n,T val)->vector{return vector(n,val);} auto v=makeVector(5,3); cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो मेकवेक्टर(इंट एन,टी वैल)->वेक्टर{रिटर्न वेक्टर(एन,वैल);} ऑटो वी=मेकवेक्टर(5,3); अदालत
53 53
35 35
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=5, val=3. Output: 53.
व्याख्या (हिन्दी) आकार=5, वैल=3. आउटपुट: 53.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Templates" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।