46 Question 46 EN + हिं GB What is the output: class A{public:int x=5; virtual int f(){return x;}}; class B:public A{public:int f()override{return x*2;}}; A a; B b; A&r=b; cout< IN आउटपुट क्या है: class A{public:int x=5; वर्चुअल int f(){रिटर्न x;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी x*2;}}; ए ए; बी बी; ए&आर=बी; अदालत A 510 510 B 55 55 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a.f()=5; r.f() virtual dispatch: B::f()=5*2=10. Output: 510. व्याख्या (हिन्दी) a.f()=5; r.f() वर्चुअल प्रेषण: B::f()=5*2=10। आउटपुट: 510. 🎯 Exam Perspective OOP Using C++ ("Inheritance" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:void f(){cout What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual void f(){cou... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
47 Question 47 EN + हिं GB What is the output: class A{public:void f(){cout<<'A';}}; class B:public A{using A::f;}; B b; b.f(); IN आउटपुट क्या है: कक्षा ए {सार्वजनिक: शून्य एफ() {काउट A A ए B Compile error संकलन त्रुटि C Undefined अपरिभाषित D B बी ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) using A::f makes A::f accessible as B::f. b.f()=A. Output: A. व्याख्या (हिन्दी) A::f का उपयोग करने से A::f को B::f के रूप में पहुंच योग्य बनाया जा सकता है। बी.एफ()=ए. आउटपुट: ए. 🎯 Exam Perspective यह सवाल OOP Using C++ ("Inheritance" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{protected:void f(){cout What is the output: class A{public:int x; A(int v):x(v)... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
48 Question 48 EN + हिं GB What is the output: class Base{public:int x=1; virtual int f(){return x;}}; class Mid:public Base{public:int x=2; int f()override{return x;}}; class Der:public Mid{public:int x=3;}; Der d; Base*p=&d; cout<f(); IN आउटपुट क्या है: class Base{public:int x=1; वर्चुअल int f(){रिटर्न x;}}; कक्षा मध्य:सार्वजनिक आधार{सार्वजनिक:int x=2; int f()ओवरराइड{रिटर्न x;}}; वर्ग डेर:सार्वजनिक मध्य{सार्वजनिक:int x=3;}; डेर डी; आधार*p=&d; अदालत A 2 2 B 3 3 C 1 1 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Mid::f() uses Mid::x=2 (its own). Output: 2. व्याख्या (हिन्दी) मिड::एफ() मिड::एक्स=2 (स्वयं का) का उपयोग करता है। आउटपुट: 2. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is 'empty base class optimization' (EBO)? What is the output: class A{public:int x; A(int v):x(v)... What is the output: class A{public:void f(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
49 Question 49 EN + हिं GB What is the output: class A{public:virtual ~A(){cout<<'A';}}; class B:public A{public:~B(){cout<<'B';}}; A*p=new B; delete p; IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल ~ए(){काउट A BA बी ० ए B AB अब C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) delete p: ~B() first=B, then ~A()=A. Output: BA. व्याख्या (हिन्दी) p हटाएं: ~B() पहले=B, फिर ~A()=A. आउटपुट: बी.ए. 🎯 Exam Perspective OOP Using C++ ("Inheritance" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class A{public:int x=1;}; class B:v... What is the output: class A{public:int x; A(int v):x(v)... What is the output: class A{public:int x=0; void f(){x+... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
50 Question 50 EN + हिं GB What is the output: class A{public:int f(int x){return x*2;}}; class B:public A{public:int f(double x){return x*3;}}; B b; cout< IN आउटपुट क्या है: क्लास ए {सार्वजनिक: int f (int x) {रिटर्न x * 2;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f(डबल x){रिटर्न x*3;}}; बी बी; अदालत A 15 15 B 10 10 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B::f(double) hides A::f. b.f(5): 5 converts to double; B::f(5.0)=5*3=15. Output: 15. व्याख्या (हिन्दी) B::f(double) A::f को छुपाता है। बी.एफ(5): 5 डबल में परिवर्तित होता है; बी::एफ(5.0)=5*3=15. आउटपुट: 15. 🎯 Exam Perspective UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Inheritance" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'empty base class optimization' (EBO)? What is the output: class A{public:int x; A(int v):x(v)... What is the output: class A{public:int x=0; A(int v=0):... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
51 Question 51 EN + हिं GB What is the output: class A{public:int x=0; A(int v=0):x(v){}}; class B:public A{public:B(int v):A(v*2){}}; B b(3); cout< IN आउटपुट क्या है: class A{public:int x=0; A(int v=0):x(v){}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:बी(int v):ए(v*2){}}; बी बी(3); अदालत A 6 6 B 3 3 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A(3*2=6): x=6. Output: 6. व्याख्या (हिन्दी) ए(3*2=6): एक्स=6। आउटपुट: 6. 🎯 Exam Perspective अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Inheritance" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is 'empty base class optimization' (EBO)? What is the output: class A{public:int x; A(int v):x(v)... What is the output: class A{public:int x=1;}; class B:v... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
52 Question 52 EN + हिं GB What is the output: class A{protected:void f(){cout<<'A';}}; class B:public A{public:void g(){f();}}; B b; b.g(); IN आउटपुट क्या है: क्लास ए {संरक्षित: शून्य एफ() {काउट A A ए B Compile error संकलन त्रुटि C Undefined अपरिभाषित D Nothing कुछ नहीं ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) g() calls protected f(). Output: A. व्याख्या (हिन्दी) g() संरक्षित f() को कॉल करता है। आउटपुट: ए. 🎯 Exam Perspective OOP Using C++ ("Inheritance" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:void f(){cout What is the output: class A{public:int x=0; A(int v=0):... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
53 Question 53 EN + हिं GB What is the output: class A{public:virtual void f(){cout<<1;} virtual void g(){cout<<2;}}; class B:public A{public:void f()override{cout<<3;}}; A*p=new B; p->f(); p->g(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 32 32 B 12 12 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) p->f(): B::f()=3; p->g(): A::g()=2. Output: 32. व्याख्या (हिन्दी) p->f(): B::f()=3; p->g(): A::g()=2. आउटपुट: 32. 🎯 Exam Perspective यह सवाल OOP Using C++ ("Inheritance" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:void f(){cout What is the output: class A{protected:void f(){cout What is the output: class A{public:int x=0; void f(){x+... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
54 Question 54 EN + हिं GB What is the output: class A{public:int x; A(int v):x(v){}}; class B:public A{public:using A::A;}; B b(42); cout< IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){}}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: ए का उपयोग करना:: ए;}; बी बी(42); अदालत A 42 42 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) using A::A inherits A(int). B b(42) calls A(42). x=42. Output: 42. व्याख्या (हिन्दी) A::A का उपयोग करने से A(int) प्राप्त होता है। बी बी(42) ए(42) को कॉल करता है। एक्स=42. आउटपुट: 42. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public:int x=1;}; class B:v... What is the output: class Base{public:int x=1; virtual... What is the output: class A{public:void f(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
55 Question 55 EN + हिं GB What is 'empty base class optimization' (EBO)? IN 'खाली बेस क्लास अनुकूलन' (ईबीओ) क्या है? A Empty base takes no space in derived object खाली आधार व्युत्पन्न वस्तु में कोई स्थान नहीं लेता है B Only for virtual bases केवल आभासी आधारों के लिए C Compiler-specific संकलक-विशिष्ट D C++17 mandatory C++17 अनिवार्य ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) If base class is empty, derived object need not be larger; EBO allows zero overhead. व्याख्या (हिन्दी) यदि बेस क्लास खाली है, तो व्युत्पन्न वस्तु को बड़ा होने की आवश्यकता नहीं है; ईबीओ शून्य ओवरहेड की अनुमति देता है। 🎯 Exam Perspective OOP Using C++ ("Inheritance" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class A{public:int f(int x){return... What is the output: class A{public:int x; A(int v):x(v)... What is the output: class A{public:void f(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
56 Question 56 EN + हिं GB What is the output: class A{public:virtual void f(){cout<<'A';}}; class B:public A{}; class C:public A{public:void f()override{cout<<'C';}}; A*p=new B; p->f(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A A ए B B बी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B inherits A::f(). Output: A. व्याख्या (हिन्दी) B को A::f() विरासत में मिला है। आउटपुट: ए. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Inheritance" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class A{public:int x=5; virtual int... What is the output: class A{public:int x=0; void f(){x+... What is the output: class A{public:int x; A(int v):x(v)... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
57 Question 57 EN + हिं GB What is the output: class A{public:int x=1;}; class B:virtual public A{public:int y=2;}; class C:virtual public A{public:int z=3;}; class D:public B,public C{}; D d; cout< IN आउटपुट क्या है: class A{public:int x=1;}; क्लास बी:वर्चुअल पब्लिक ए{पब्लिक:इंट वाई=2;}; कक्षा सी:वर्चुअल पब्लिक ए{सार्वजनिक:int z=3;}; कक्षा डी:सार्वजनिक बी,सार्वजनिक सी{}; डी डी; अदालत A 123 123 B 112 112 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Single A: x=1. y=2,z=3. Output: 123. व्याख्या (हिन्दी) एकल ए: x=1. y=2,z=3. आउटपुट: 123. 🎯 Exam Perspective अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Inheritance" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:int x=0; void f(){x+... What is the output: class A{public:int x; A(int v):x(v)... What is the output: class Base{public:int x=1; virtual... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
58 Question 58 EN + हिं GB What is the output: class A{public:void f(){cout<<'A';} virtual void g(){cout<<'a';}}; class B:public A{public:void f(){cout<<'B';} void g()override{cout<<'b';}}; A a=B(); a.f(); a.g(); IN आउटपुट क्या है: कक्षा ए {सार्वजनिक: शून्य एफ() {काउट A Aa आ B Bb बी बी C AB अब D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A object (sliced): a.f()=non-virtual=A; a.g()=virtual but object is A type=a. Output: Aa. व्याख्या (हिन्दी) एक वस्तु (कटी हुई): a.f()=non-virtual=A; a.g()=आभासी लेकिन वस्तु A प्रकार=a है। आउटपुट: आ. 🎯 Exam Perspective OOP Using C++ ("Inheritance" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:int x=0; void f(){x+... What is the output: class A{protected:void f(){cout What is 'empty base class optimization' (EBO)? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
59 Question 59 EN + हिं GB What is the output: class A{public:int x; A(int v):x(v){} virtual A* clone(){return new A(*this);}}; class B:public A{public:B(int v):A(v){} B* clone()override{return new B(*this);}}; A*p=new B(5); A*q=p->clone(); cout<x; IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} वर्चुअल A* क्लोन(){वापसी नया A(*this);}}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: बी (int v): ए (v) {} बी * क्लोन() ओवरराइड {नया बी लौटाएं (* यह);}}; ए*पी=नया बी(5); A*q=p->क्लोन(); अदालत A 5 5 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B::clone returns new B(5). q->x=5. Output: 5. व्याख्या (हिन्दी) बी::क्लोन नया बी(5) लौटाता है। q->x=5. आउटपुट: 5. 🎯 Exam Perspective यह सवाल OOP Using C++ ("Inheritance" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:int x=5; virtual int... What is the output: class A{public:int x=0; A(int v=0):... What is the output: class A{public:virtual void f(){cou... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
60 Question 60 EN + हिं GB What is the output: class A{public:int x=0; void f(){x++; cout< IN आउटपुट क्या है: class A{public:int x=0; शून्य f(){x++; अदालत A 11 11 B 12 12 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) b and c each have own x=0. b.f(): x=1, print 1. c.f(): x=1, print 1. Output: 11. व्याख्या (हिन्दी) b और c प्रत्येक का अपना x=0 है। b.f(): x=1, प्रिंट 1. c.f(): x=1, प्रिंट 1. आउटपुट: 11. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public:int x=0; A(int v=0):... What is the output: class A{public:void f(){cout What is the output: class A{public:virtual void f(){cou... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)