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 1711

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

Question 1712

EN + हिं
GB What is the output: class A{public:int x; A():x(0){cout<<'0';} A(int v):x(v){cout<<'I';} ~A(){cout<<'D';}}; A arr[3];
IN आउटपुट क्या है: class A{public:int x; A():x(0){cout
000DDD 000डीडीडी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
0I0DDD 0आई0डीडीडी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3 default ctors: 000. 3 dtors: DDD. Output: 000DDD.
व्याख्या (हिन्दी) 3 डिफ़ॉल्ट ctors: 000. 3 dtors: DDD. आउटपुट: 000DDD.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1713

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

Question 1714

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

Question 1715

EN + हिं
GB What is the output: class A{public:vectorv; A(initializer_listil):v(il){}}; A a={1,2,3,4,5}; cout<
IN आउटपुट क्या है: class A{public:vectorv; ए(इनिशियलाइज़र_लिस्टिल):v(il){}}; ए ए={1,2,3,4,5}; अदालत
53 53
51 51
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=5, v[2]=3. Output: 53.
व्याख्या (हिन्दी) आकार=5, वी[2]=3. आउटपुट: 53.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1716

EN + हिं
GB What is the output: class A{int x; public:A(int v):x(v){} friend bool operator<(const A& a,const A& b){return a.x
IN आउटपुट क्या है: class A{int x; सार्वजनिक:ए(int v):x(v){} मित्र बूल ऑपरेटर
14 14
34 34
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,2,3,4. arr[0].x=1,arr[3].x=4. Output: 14.
व्याख्या (हिन्दी) क्रमबद्ध: 1,2,3,4. गिरफ्तारी[0].x=1, गिरफ्तारी[3].x=4. आउटपुट: 14.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1717

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

Question 1718

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

Question 1719

EN + हिं
GB What is the output: class A{public:int x,y; A(int a,int b):y(b),x(a+y){}}; A a(1,2); cout<
IN आउटपुट क्या है: class A{public:int x,y; A(int a,int b):y(b),x(a+y){}}; ए ए(1,2); अदालत
Undefined behavior अपरिभाषित व्यवहार
32 32
12 12
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Members init in declaration order: x first, then y. x=a+y where y is uninitialized = UB.
व्याख्या (हिन्दी) सदस्य घोषणा क्रम में आरंभ करते हैं: पहले x, फिर y। x=a+y जहां y आरंभीकृत नहीं है = UB.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1720

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

Question 1721

EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){cout<
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){cout
3-4 3-4
33 33
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ctor prints 3; dtor prints ~3=-4. Output: 3-4.
व्याख्या (हिन्दी) ctor प्रिंट्स 3; डीटीओआर ~3=-4 प्रिंट करता है। आउटपुट: 3-4.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1722

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

Question 1723

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

Question 1724

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

Question 1725

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