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 1666

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

Question 1667

EN + हिं
GB What is the output: int x=0; auto p=&x; for(int i=0;i<5;++i) ++*p; cout<
IN आउटपुट क्या है: int x=0; ऑटो पी=&x; for(int i=0;i
5 5
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p is x; incremented 5 times. Output: 5.
व्याख्या (हिन्दी) *पी एक्स है; 5 गुना वृद्धि. आउटपुट: 5.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1668

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

Question 1669

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

Question 1670

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

Question 1671

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

Question 1672

EN + हिं
GB What is the output: class A{public:int x=0; A(int v=0):x(v){} bool operator<(const A& o)const{return xv={{5},{3},{8},{1}}; sort(v.begin(),v.end()); cout<
IN आउटपुट क्या है: class A{public:int x=0; A(int v=0):x(v){} बूल ऑपरेटर
18 18
81 81
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,3,5,8. v[0].x=1,v[3].x=8. Output: 18.
व्याख्या (हिन्दी) क्रमबद्ध: 1,3,5,8. v[0].x=1,v[3].x=8. आउटपुट: 18.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1673

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

Question 1674

EN + हिं
GB What is the output: class Vec{public:double x,y; Vec(double a,double b):x(a),y(b){} double dot(const Vec& v)const{return x*v.x+y*v.y;}}; Vec a(1,2),b(3,4); cout<
IN आउटपुट क्या है: class Vec{public:double x,y; Vec(double a,double b):x(a),y(b){} डबल डॉट(const Vec& v)const{return x*v.x+y*v.y;}}; Vec a(1,2),b(3,4); अदालत
11 11
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*3+2*4=11. Output: 11.
व्याख्या (हिन्दी) 1*3+2*4=11. आउटपुट: 11.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1675

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

Question 1676

EN + हिं
GB What is the output: class A{public:int data[3]; A(int a,int b,int c){data[0]=a;data[1]=b;data[2]=c;} int& operator[](int i){return data[i];}}; A a(1,2,3); a[1]=10; cout<
IN आउटपुट क्या है: क्लास ए{पब्लिक:इंट डेटा[3]; A(int a,int b,int c){data[0]=a;data[1]=b;data[2]=c;} int& ऑपरेटर[](int i){return data[i];}}; ए ए(1,2,3); ए[1]=10; अदालत
1103 1103
123 123
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[1]=10. Output: 1103.
व्याख्या (हिन्दी) ए[1]=10. आउटपुट: 1103.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1677

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

Question 1678

EN + हिं
GB What is the output: class A{int x=1; public: class B{int y=2; public: void f(A& a){cout<
IN आउटपुट क्या है: class A{int x=1; सार्वजनिक: वर्ग B{int y=2; सार्वजनिक: शून्य f(A&a){cout
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) B::f accesses A::x=1. 1+2=3. Output: 3.
व्याख्या (हिन्दी) B::f A::x=1 तक पहुँचता है। 1+2=3. आउटपुट: 3.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1679

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

Question 1680

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