OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye.

📚 107 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
107 questions

Question 46

EN + हिं
GB What is the output: class A{public:int x=1,y=2; A(int v):y(v),x(y){}}; A a(5); cout<
IN आउटपुट क्या है: class A{public:int x=1,y=2; A(int v):y(v),x(y){}}; ए ए(5); अदालत
25 25
15 15
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x initialized first (declaration order): x=y is UB — y not yet initialized. Undefined.
व्याख्या (हिन्दी) x को पहले प्रारंभ किया गया (घोषणा क्रम): x=y यूबी है - y को अभी तक प्रारंभ नहीं किया गया है। अपरिभाषित.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 47

EN + हिं

Question 48

EN + हिं
GB What is the output: class A{public:A(){cout<<'A';}}; class B{public:B(){cout<<'B';}}; class C:public A{B b; public:C(){cout<<'C';}}; C c;
IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट
ABC एबीसी
CBA सीबीए
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A() base first, B() member next, C() body last. Output: ABC.
व्याख्या (हिन्दी) A() आधार पहले, B() सदस्य अगला, C() निकाय अंतिम। आउटपुट: एबीसी.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Constructors and Destructors" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 49

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

Question 50

EN + हिं
GB What is the output: class A{public:int x=0; A(){} A(A&&o):x(o.x){o.x=-1;}}; A a; a.x=5; A b=move(a); cout<
IN आउटपुट क्या है: class A{public:int x=0; A(){} A(A&&o):x(o.x){o.x=-1;}}; ए ए; a.x=5; ए बी = चाल (ए); अदालत
-15 -15
5-1 5-1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) -1 then 5. Output: -15.
व्याख्या (हिन्दी) -1 फिर 5. आउटपुट: -15.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Constructors and Destructors" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 51

EN + हिं
GB What is the output: class A{static int n; public: A(){n++;} ~A(){n (1, 6, 79, 9, 4, 'What is the output: class A{public:int* p; A():p(new int(5)){} A(const A& o):p(new int(*o.p)){} ~A(){delete p;}}; A a; A b=a; *b.p=10; cout<<*a.p<<*b.p;', 'Deep copy ctor?', '510', '510', '1010', '1010', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', 'Deep copy: b gets own int. *b.p=10 doesn't affect *a.p=5. Output: 510.
IN आउटपुट क्या है: class A{static int n; सार्वजनिक: A(){n++;} ~A(){n (1, 6, 79, 9, 4, 'आउटपुट क्या है: क्लास ए {सार्वजनिक: int * p; A():p(new int(5)){} A(const A& o):p(new int(*op.p)){} ~A(){delete p;}}; A a; A b=a; *b.p=10; cout
2026-05-25 2026-05-25
✅ Correct Answer:
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 52

EN + हिं
GB What is the output: class A{public:int* p; A():p(new int(5)){} A(const A& o):p(new int(*o.p)){} ~A(){delete p;}}; A a; A b=a; *b.p=10; cout<<*a.p<<*b.p;
IN आउटपुट क्या है: class A{public:int* p; A():p(new int(5)){} A(const A& o):p(new int(*o.p)){} ~A(){delete p;}}; ए ए; ए बी=ए; *बी.पी=10; अदालत
510 510
1010 1010
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Deep copy: b gets own int. *b.p=10 doesn't affect *a.p=5. Output: 510.
व्याख्या (हिन्दी) डीप कॉपी: बी को अपना इंट मिलता है। *बी.पी=10 *ए.पी=5 को प्रभावित नहीं करता। आउटपुट: 510.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 53

EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} A& operator=(const A& o){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; वापसी *यह;}}; ए ए(3),बी(5); ए=बी; अदालत
5 5
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a.x=b.x=5. Output: 5.
व्याख्या (हिन्दी) a.x=b.x=5. आउटपुट: 5.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 54

EN + हिं
GB What is the output: class A{public:~A()=default; A()=default;}; A a; cout<<'X';
IN आउटपुट क्या है: class A{public:~A()=default; ए()=डिफ़ॉल्ट;}; ए ए; अदालत
X एक्स
Compile error संकलन त्रुटि
Undefined अपरिभाषित
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Valid; prints X. Output: X.
व्याख्या (हिन्दी) वैध; एक्स प्रिंट करता है। आउटपुट: एक्स।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Constructors and Destructors" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 55

EN + हिं
GB What is the output: class A{public:A(){cout<<'N';} A(int){cout<<'I';} A(double){cout<<'D';} A(const A&){cout<<'C';}}; A a=5; A b=5.0; A c=a;
IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट
IDC आईडीसी
NIC एनआईसी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=5: A(int)=I; b=5.0: A(double)=D; c=a: copy=C. Output: IDC.
व्याख्या (हिन्दी) a=5: A(int)=I; बी=5.0: ए(डबल)=डी; सी=ए: कॉपी=सी. आउटपुट: आईडीसी.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 56

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

Question 57

EN + हिं
GB What is 'deleted special member'?
IN 'हटाए गए विशेष सदस्य' क्या है?
=delete explicitly disables the function =delete फ़ंक्शन को स्पष्ट रूप से अक्षम कर देता है
Makes function private फ़ंक्शन को निजी बनाता है
Pure virtual शुद्ध आभासी
Not callable कॉल करने योग्य नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A(const A&)=delete; prevents copy construction; attempting it is a compile error.
व्याख्या (हिन्दी) ए(स्थिरांक ए&)=हटाएं; प्रतिलिपि निर्माण को रोकता है; इसका प्रयास करना एक संकलन त्रुटि है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 58

EN + हिं
GB What is the output: class A{public:int x; A():x(0){} A(A&&o) noexcept:x(o.x){o.x=0;} A(const A&)=delete;}; A f(){return A();} A a=f(); cout<
IN आउटपुट क्या है: class A{public:int x; A():x(0){} A(A&&o) noexcept:x(o.x){o.x=0;} A(const A&)=delete;}; A f(){वापसी A();} A a=f(); अदालत
Compile error संकलन त्रुटि
Undefined अपरिभाषित
5 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A() created then moved/elided into a. a.x=0. Output: 0.
व्याख्या (हिन्दी) A() बनाया गया और फिर a में स्थानांतरित/एलिंड किया गया। a.x=0. आउटपुट: 0.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 59

EN + हिं
GB What is the output: class A{public:int x=0; A(int v):x(v){} A& operator+=(const A& o){x+=o.x;return *this;}}; A a(3),b(4); a+=b; cout<
IN आउटपुट क्या है: class A{public:int x=0; A(int v):x(v){} A& ऑपरेटर+=(const A& o){x+=o.x;return *this;}}; ए ए(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
यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 60

EN + हिं
GB What is the output: class A{int x; public: void setX(int v){x=v;} int getX()const{return x;} A():x(100){}}; A a; cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: void setX(int v){x=v;} int getX()const{return x;} A():x(100){}}; ए ए; अदालत
100200 100200
200200 200200
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Initial x=100; after setX(200): x=200. Output: 100200.
व्याख्या (हिन्दी) आरंभिक x=100; सेटएक्स(200) के बाद: x=200। आउटपुट: 100200.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Constructors and Destructors" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।