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 1681

EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} A(const A& o):x(o.x){} A& operator=(A o){swap(x,o.x);return *this;}}; A a(3),b(5); a=b; cout<
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} A(const A& o):x(o.x){} A& ऑपरेटर=(A o){swap(x,o.x);return *this;}}; ए ए(3),बी(5); ए=बी; अदालत
53 53
55 55
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=b: copy b to o(x=5), swap a.x and o.x: a.x=5,o.x=3. Output: 53.
व्याख्या (हिन्दी) a=b: b को o(x=5) पर कॉपी करें, a.x और o.x को स्वैप करें: a.x=5,o.x=3. आउटपुट: 53.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1682

EN + हिं
GB What is the output: class A{public:int n; A(int v):n(v){} bool operator==(const A& o)const{return n==o.n;} bool operator!=(const A& o)const{return !(*this==o);}}; A a(3),b(3),c(4); cout<<(a==b)<<(a!=c);
IN आउटपुट क्या है: class A{public:int n; A(int v):n(v){} bool ऑपरेटर==(const A&o)const{return n==on.n;} बूल ऑपरेटर!=(const A& o)const{return !(*this==o);}}; ए ए(3),बी(3),सी(4); अदालत
11 11
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3==3=1; 3!=4=1. Output: 11.
व्याख्या (हिन्दी) 3==3=1; 3!=4=1. आउटपुट: 11.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1683

EN + हिं
GB What is the output: class A{mutable int cache=-1; public:int compute(int x)const{if(cache==-1)cache=x*x; return cache;}}; const A a; cout<
IN आउटपुट क्या है: क्लास ए{म्यूटेबल इंट कैश=-1; सार्वजनिक:int कंप्यूट(int x)const{if(cache==-1)cache=x*x; कैश वापसी;}}; स्थिरांक ए ए; अदालत
2525 2525
2536 2536
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First call: cache=25. Second call: cache already set=25. Output: 2525.
व्याख्या (हिन्दी) पहली कॉल: कैश=25. दूसरा कॉल: कैश पहले से ही सेट = 25। आउटपुट: 2525.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1684

EN + हिं
GB What is the output: class A{public:int x,y; A(int a,int b):x(a),y(b){} auto operator<=>(const A&)const=default;}; A a{1,2},b{1,3}; cout<<(a
IN आउटपुट क्या है: class A{public:int x,y; A(int a,int b):x(a),y(b){} ऑटो ऑपरेटर(const A&)const=default;}; ए ए{1,2},बी{1,3}; अदालत
10 10
01 01
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Lexicographic: (1,2)<(1,3)=1; (1,2)==(1,3)=0. Output: 10.
व्याख्या (हिन्दी) शब्दकोष: (1,2)
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1685

EN + हिं
GB What is the output: class A{int x; public: A(int v=0):x(v){} int get()const{return x;} A operator+(const A& o)const{return A(x+o.x);} A operator*(const A& o)const{return A(x*o.x);}}; A a(2),b(3),c(4); cout<<(a+b*c).get();
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v=0):x(v){} int get()const{return x;} एक ऑपरेटर+(const A& o)const{return A(x+o.x);} एक ऑपरेटर*(const A& o)const{return A(x*o.x);}}; ए ए(2),बी(3),सी(4); अदालत
14 14
20 20
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b*c=12; a+12=14. Output: 14.
व्याख्या (हिन्दी) बी*सी=12; ए+12=14. आउटपुट: 14.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1686

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

Question 1687

EN + हिं
GB What is the output: class A{int x; public: A(int v):x(v){} auto operator*(const A& o)const{return A(x*o.x);} int get()const{return x;}}; A a(2); auto r=a*a*a; cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v):x(v){} ऑटो ऑपरेटर*(const A& o)const{return A(x*o.x);} int get()const{return x;}}; ए ए(2); ऑटो r=a*a*a; अदालत
8 8
4 4
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2*2=4; 4*2=8. Output: 8.
व्याख्या (हिन्दी) 2*2=4; 4*2=8. आउटपुट: 8.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1688

EN + हिं
GB What is the output: class Ratio{int n,d; public:Ratio(int a,int b):n(a),d(b){} double val()const{return (double)n/d;}}; Ratio r(3,4); cout<
IN आउटपुट क्या है: वर्ग अनुपात {int n,d; सार्वजनिक:अनुपात(int a,int b):n(a),d(b){} डबल वैल()const{रिटर्न (डबल)n/d;}}; अनुपात r(3,4); अदालत
0.75 0.75
0.5 0.5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3/4=0.75. Output: 0.75.
व्याख्या (हिन्दी) 3/4=0.75. आउटपुट: 0.75.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1689

EN + हिं
GB What is the output: class A{int x=5; public:int get()const{return x;} friend bool eq(A a,A b){return a.x==b.x;}}; A a,b; cout<
IN आउटपुट क्या है: class A{int x=5; सार्वजनिक:int get()const{return x;} मित्र bool eq(A a,A b){return a.x==b.x;}}; ए ए, बी; अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both x=5. eq=1. Output: 1.
व्याख्या (हिन्दी) दोनों x=5. eq=1. आउटपुट: 1.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1690

EN + हिं
GB What is the output: class A{public:int x=0; auto operator[](int i)->int&{x=i;return x;}}; A a; a[5]=10; cout<
IN आउटपुट क्या है: class A{public:int x=0; ऑटो ऑपरेटर[](int i)->int&{x=i;return x;}}; ए ए; ए[5]=10; अदालत
10 10
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[5]: x=5, returns x. a[5]=10: assigns 10 to x. Output: 10.
व्याख्या (हिन्दी) a[5]: x=5, x लौटाता है। a[5]=10: x को 10 निर्दिष्ट करता है। आउटपुट: 10.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1691

EN + हिं
GB What is the output: class A{public:vectorv; void push(int x){v.push_back(x);} int sum()const{return accumulate(v.begin(),v.end(),0);}}; A a; a.push(1);a.push(2);a.push(3); cout<
IN आउटपुट क्या है: class A{public:vectorv; शून्य पुश(int x){v.push_back(x);} int sum()const{रिटर्न एक्युमेटेड(v.begin(),v.end(),0);}}; ए ए; ए.पुश(1);ए.पुश(2);ए.पुश(3); अदालत
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++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1692

EN + हिं
GB 'What is the output: class A{static int count; public:A(){count++;} ~A(){count (1, 6, 78, 8, 4, 'What is the output: class A{public:int x=10; A* self(){return this;}}; A a; cout<x;', 'this pointer return?', '10', '10', 'Compile error', 'Compile error', 'Undefined', 'Undefined', '0', '0', NULL, 'option_a', 'self() returns this; ->x=10. Output: 10.', 0, '2026-05-25', '2026-05-25'), (1, 6, 78, 8, 4, 'What is the output: class A{public:int x; A(int v):x(v){} bool isPositive()const{return x>0;} bool isEven()const{return x%2==0;}}; A a(4); cout<0=1; 4%2==0=1. Output: 11.', 0, '2026-05-25', '2026-05-25'), (1, 6, 78, 8, 4, 'What is the output: class A{int x=5; public:operator string()const{return to_string(x);}}; A a; string s=a; cout<
IN 'आउटपुट क्या है: क्लास ए {स्टेटिक इंट काउंट; सार्वजनिक:ए(){गिनती++;} ~ए(){गिनती (1, 6, 78, 8, 4, 'आउटपुट क्या है: क्लास ए{पब्लिक:इंट x=10; ए* सेल्फ(){इसे लौटाएं;}}; ए ए; कॉउटएक्स=10। आउटपुट: 10.', 0, '2026-05-25', '2026-05-25'), (1, 6, 78, 8, 4, 'आउटपुट क्या है: वर्ग ए {सार्वजनिक: int x; A (int v): x (v) {} bool isPositive() const {return x>0;} bool isEven() const {return x%2==0;}}; A a(4); cout
Move with elision (C++17)? एलिज़न (सी++17) के साथ आगे बढ़ें?
C5 सी 5
CM5 सीएम5
CCD5 सीसीडी5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) option_a
व्याख्या (हिन्दी) विकल्प_ए
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1693

EN + हिं
GB What is the output: class A{public:int x=10; A* self(){return this;}}; A a; cout<x;
IN आउटपुट क्या है: class A{public:int x=10; A* self(){इसे वापस करो;}}; ए ए; अदालत
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) self() returns this; ->x=10. Output: 10.
व्याख्या (हिन्दी) self() इसे लौटाता है; ->x=10. आउटपुट: 10.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1694

EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} bool isPositive()const{return x>0;} bool isEven()const{return x%2==0;}}; A a(4); cout<
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} bool isPositive()const{return x>0;} bool isEven()const{return x%2==0;}}; ए ए(4); अदालत
11 11
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4>0=1; 4%2==0=1. Output: 11.
व्याख्या (हिन्दी) 4>0=1; 4%2==0=1. आउटपुट: 11.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1695

EN + हिं
GB What is the output: class A{int x=5; public:operator string()const{return to_string(x);}}; A a; string s=a; cout<
IN आउटपुट क्या है: class A{int x=5; सार्वजनिक:ऑपरेटर स्ट्रिंग() स्थिरांक {वापसी_स्ट्रिंग (x);}}; ए ए; स्ट्रिंग एस=ए; अदालत
15 15
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) to_string(5)="5"; size=1. Output: 15.
व्याख्या (हिन्दी) to_string(5)='5'; आकार=1. आउटपुट: 15.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।