91 Question 91 EN + हिं GB What is the output: class A{public:virtual void f()=0; virtual ~A()=default;}; class B:public A{public:void f()override{}}; A *p=new B; delete p; cout<<'X'; IN आउटपुट क्या है: class A{public:virtual void f()=0; आभासी ~ए()=डिफ़ॉल्ट;}; class B:public A{public:void f()override{}}; ए *पी=नया बी; पी हटाएं; अदालत A X एक्स B Compile error संकलन त्रुटि C Undefined अपरिभाषित D UB यूबी ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Virtual dtor ensures proper cleanup. Output: X. व्याख्या (हिन्दी) वर्चुअल डीटोर उचित सफाई सुनिश्चित करता है। आउटपुट: एक्स. 🎯 Exam Perspective OOP Using C++ ("Polymorphism" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual int f(){retu... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
92 Question 92 EN + हिं GB What is the output: class A{public:virtual int f(){return 1;} int h(){return f()*f();}}; class B:public A{public:int f()override{return 3;}}; B b; cout< IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल इंट एफ(){रिटर्न 1;} इंट एच(){रिटर्न एफ()*एफ();}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक:int f()ओवरराइड{वापसी 3;}}; बी बी; अदालत A 9 9 B 1 1 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B::f()=3. h()=3*3=9. Output: 9. व्याख्या (हिन्दी) बी::एफ()=3. एच()=3*3=9. आउटपुट: 9. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Polymorphism" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual void f()=0;... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
93 Question 93 EN + हिं GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; B b; A &r=b; r.f();B &rb=b;rb.f(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 22 22 B 12 12 C Compile error Compile error D Undefined Undefined ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Both r.f() and rb.f() dispatch to B::f()=2. Output: 22. व्याख्या (हिन्दी) r.f() और rb.f() दोनों B::f()=2 को भेजते हैं। आउटपुट: 22. 🎯 Exam Perspective अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Polymorphism" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual int f(){retu... What is the output: class A{public:virtual void f()=0;... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
94 Question 94 EN + हिं GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; mapm;m["a"]=new A;m["b"]=new B; for(auto&[k,v]:m)v->f(); IN What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; mapm;m["a"]=new A;m["b"]=new B; for(auto&[k,v]:m)v->f(); A 12 12 B 21 21 C Compile error Compile error D Undefined Undefined ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Sorted keys: a=A=1, b=B=2. Output: 12. व्याख्या (हिन्दी) क्रमबद्ध कुंजियाँ: a=A=1, b=B=2. आउटपुट: 12. 🎯 Exam Perspective OOP Using C++ ("Polymorphism" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f()=0;... What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual int f(){retu... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)