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 1576

EN + हिं
GB What is the output: int f(int a,int b,int c){return a>b?(a>c?a:c):(b>c?b:c);} cout<
IN आउटपुट क्या है: int f(int a,int b,int c){return a>b?(a>c?a:c):(b>c?b:c);} cout
7 7
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=3,b=7,c=5. a>b false: b>c?b:c=7. Output: 7.
व्याख्या (हिन्दी) ए=3,बी=7,सी=5. a>b गलत: b>c?b:c=7. आउटपुट: 7.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1577

EN + हिं
GB What is the output: template bool all(vectorv,functionp){for(T x:v) if(!p(x)) return false; return true;} cout<({2,4,6},[](int x){return x%2==0;});
IN आउटपुट क्या है: template bool all(vectorv,functionp){for(T x:v) if(!p(x)) return false; सच लौटें;} कोउट
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All even. Output: 1.
व्याख्या (हिन्दी) सब सम. आउटपुट: 1.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1578

EN + हिं
GB What is the output: int f(int n){int r=0; while(n>0){r=r*10+n%10;n/=10;} return r;} cout<
IN आउटपुट क्या है: int f(int n){int r=0; while(n>0){r=r*10+n%10;n/=10;} return r;} cout
4321 4321
1234 1234
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reversed: 4321. Output: 4321.
व्याख्या (हिन्दी) उलटा: 4321. आउटपुट: 4321.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1579

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

Question 1580

EN + हिं
GB What is the output: bool f(string s){int n=s.size();for(int i=0;i
IN आउटपुट क्या है: bool f(string s){int n=s.size();for(int i=0;i
10 10
11 11
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) racecar=palindrome=1; hello=not=0. Output: 10.
व्याख्या (हिन्दी) रेसकार=पैलिंड्रोम=1; नमस्ते=नहीं=0. आउटपुट: 10.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1581

EN + हिं
GB What is the output: int f(vector&v,int l,int r){if(l>r)return -1;int m=(l+r)/2;return v[m]<5?f(v,m+1,r):v[m]==5?m:f(v,l,m-1);} vectorv={1,2,3,4,5,6,7}; cout<
IN आउटपुट क्या है: int f(vector&v,int l,int r){if(l>r)return -1;int m=(l+r)/2;return v[m]
4 4
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 is at index 4. Output: 4.
व्याख्या (हिन्दी) 5 सूचकांक 4 पर है। आउटपुट: 4।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1582

EN + हिं
GB What is the output: int f(int x){return x<=1?x:f(x-1)+f(x-2);} int g(int n){int s=0;for(int i=0;i
IN आउटपुट क्या है: int f(int x){return x
20 20
33 33
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0+1+1+2+3+5+8=20. Output: 20.
व्याख्या (हिन्दी) 0+1+1+2+3+5+8=20. आउटपुट: 20.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1583

EN + हिं
GB What is the output: string f(int n){if(n==0)return "0";string r="";while(n){r=char('0'+n%2)+r;n/=2;} return r;} cout<
IN आउटपुट क्या है: स्ट्रिंग f(int n){if(n==0)return "0";string r=""; while(n){r=char('0'+n%2)+r;n/=2;} return r;} cout
1010 1010
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10 in binary=1010. Output: 1010.
व्याख्या (हिन्दी) बाइनरी में 10=1010. आउटपुट: 1010.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1584

EN + हिं
GB What is the output: int f(int a,int b){return a>b?a-b:b-a;} cout<
IN आउटपुट क्या है: int f(int a,int b){return a>b?a-b:b-a;} cout
8 8
4 4
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4+4=8. Output: 8.
व्याख्या (हिन्दी) 4+4=8. आउटपुट: 8.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1585

EN + हिं
GB What is the output: auto curry=[](int a){return [a](int b){return [a,b](int c){return a+b+c;};};};cout<
IN आउटपुट क्या है: ऑटो करी = [] (इंट ए) {रिटर्न [ए] (इंट बी) {रिटर्न [ए, बी] (इंट सी) {रिटर्न ए + बी + सी;};};}; कॉउट
6 6
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3=6. Output: 6.
व्याख्या (हिन्दी) 1+2+3=6. आउटपुट: 6.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1586

EN + हिं
GB What is the output: int f(int n,int d=10){return n
IN आउटपुट क्या है: int f(int n,int d=10){return n
37 37
7 7
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(37): 37>=10: f(27)+10; f(27):f(17)+10; f(17):f(7)+10; f(7)=7. Total=7+10+10+10=37. Output: 37. Hmm: returns n itself if n
व्याख्या (हिन्दी) f(37): 37>=10: f(27)+10; एफ(27):एफ(17)+10; एफ(17):एफ(7)+10; एफ(7)=7. कुल=7+10+10+10=37. आउटपुट: 37. हम्म: यदि n है तो n ही लौटाता है
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1587

EN + हिं
GB What is the output: int count_if_positive(vectorv){return count_if(v.begin(),v.end(),[](int x){return x>0;});} cout<
IN आउटपुट क्या है: int count_if_positive(vectorv){return count_if(v.begin(),v.end(),[](int x){return x>0;});} cout
3 3
2 2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2,4,5 are positive. Count=3. Output: 3.
व्याख्या (हिन्दी) 2,4,5 सकारात्मक हैं. गिनती=3. आउटपुट: 3.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1588

EN + हिं
GB What is the output: int f(int x){return x*(x-1)/2;} cout<
IN आउटपुट क्या है: int f(int x){return x*(x-1)/2;} cout
16 16
15 15
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) T(5)=10, T(4)=6. 10+6=16. Output: 16.
व्याख्या (हिन्दी) टी(5)=10, टी(4)=6. 10+6=16. आउटपुट: 16.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1589

EN + हिं
GB What is the output: auto f=[](auto v){return accumulate(v.begin(),v.end(),0);}; cout<
IN आउटपुट क्या है: ऑटो f=[](ऑटो v){रिटर्न एक्युमेटेड(v.begin(),v.end(),0);}; अदालत
15 15
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1590

EN + हिं
GB What is the output: int f(int n){if(n<=0)return 0;return f(n-1)*2+(n%2);}cout<
IN आउटपुट क्या है: int f(int n){if(n
21 21
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(1)=f(0)*2+1=1; f(2)=f(1)*2+0=2; f(3)=2*2+1=5; f(4)=5*2+0=10; f(5)=10*2+1=21. Output: 21.
व्याख्या (हिन्दी) f(1)=f(0)*2+1=1; f(2)=f(1)*2+0=2; f(3)=2*2+1=5; f(4)=5*2+0=10; f(5)=10*2+1=21. आउटपुट: 21.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।