1786 Question 1786 EN + हिं GB What is the output: class A{public:virtual void f()=0; virtual ~A()=default;}; class B:public A{int x; public:B(int v):x(v){} void f()override{cout<>v; v.push_back(make_shared(5)); v.push_back(make_shared(10)); for(auto&p:v)p->f(); IN आउटपुट क्या है: class A{public:virtual void f()=0; आभासी ~ए()=डिफ़ॉल्ट;}; कक्षा बी:सार्वजनिक ए{int x; सार्वजनिक:B(int v):x(v){} void f()ओवरराइड{cout A 510 510 B Compile error संकलन त्रुटि C Undefined अपरिभाषित D 5 10 5 10 ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B::f() prints x. Output: 510. व्याख्या (हिन्दी) B::f() x प्रिंट करता है। आउटपुट: 510. 🎯 Exam Perspective OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{int x; public:A(int v):x(v)... What is the output: class A{vectorv; public:void add(in... What is the output: class Safe{int arr[10]={0}; public:... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1787 Question 1787 EN + हिं GB What is the output: class A{public:virtual void f(){cout<<1;}}; class B:public A{public:void f()override{cout<<2;}}; A* p=new B; cout< IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 1B 1बी B 1A 1 क C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) typeid(*p) with virtual = B's typeinfo. GCC: '1B'. Output: 1B. व्याख्या (हिन्दी) टाइपआईडी(*पी) वर्चुअल = बी के टाइपइन्फो के साथ। जीसीसी: '1बी'. आउटपुट: 1बी. 🎯 Exam Perspective यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class Safe{int arr[10]={0}; public:... What is the output: class A{int x=1,y=2,z=3; public:aut... What is the output: class A{int x=0,y=0; public:void se... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1788 Question 1788 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++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{int x=5; public:int get()co... What is the output: class A{int x; public:A(int v):x(v)... 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)
1789 Question 1789 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 OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि 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{int x=0; public:int get()co... 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)
1790 Question 1790 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 संकलन त्रुटि D 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++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class Safe{int arr[10]={0}; public:... What is the output: class A{int x=0,y=0; public:void se... 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)
1791 Question 1791 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 आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 12 12 B 21 21 C Compile error संकलन त्रुटि D 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 अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह 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 void f()=0;... What is the output: class A{int x=0; public:int get()co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1792 Question 1792 EN + हिं GB What is the output: class A{int x=5; public:int get()const{return x;} void set(int v){if(v>0)x=v;}}; A a; a.set(-3); cout< IN आउटपुट क्या है: class A{int x=5; सार्वजनिक:int get()const{return x;} void set(int v){if(v>0)x=v;}}; ए ए; ए.सेट(-3); अदालत A 57 57 B 55 55 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Rejected -3; 7 accepted. Output: 57. व्याख्या (हिन्दी) अस्वीकृत -3; 7 स्वीकृत. आउटपुट: 57. 🎯 Exam Perspective OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class Safe{int arr[10]={0}; public:... What is the output: class A{int x; public:A(int v):x(v)... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1793 Question 1793 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)const{return {x+o.x};}}; A a(3),b(4); A c=a+b; cout< IN आउटपुट क्या है: class A{int x; सार्वजनिक:ए(int v):x(v){} int get()const{return x;} A ऑपरेटर+(const A& o)const{return {x+o.x};}}; ए ए(3),बी(4); ए सी=ए+बी; अदालत A 7 7 B 12 12 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 3+4=7. Output: 7. व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7. 🎯 Exam Perspective यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{int x=0; public:int get()co... 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)
1794 Question 1794 EN + हिं GB What is the output: class A{int x=0,y=0; public:void setX(int v){x=v;} void setY(int v){y=v;} int sum()const{return x+y;}}; A a; a.setX(3); a.setY(4); cout< IN आउटपुट क्या है: class A{int x=0,y=0; सार्वजनिक:void setX(int v){x=v;} void setY(int v){y=v;} int sum()const{return x+y;}}; ए ए; ए.सेटएक्स(3); a.setY(4); अदालत A 7 7 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 3+4=7. Output: 7. व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7. 🎯 Exam Perspective यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public:virtual void f(){cou... What is the output: class A{public:virtual void f()=0;... What is the output: class A{vectorv; public:void add(in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1795 Question 1795 EN + हिं GB What is the output: class A{vectorv; public:void add(int x){if(x>=0)v.push_back(x);} int max()const{return *max_element(v.begin(),v.end());}}; A a; a.add(-1);a.add(3);a.add(7);a.add(-2);a.add(5); cout< IN आउटपुट क्या है: class A{vectorv; सार्वजनिक:शून्य जोड़ें(int x){if(x>=0)v.push_back(x);} int max()const{return *max_element(v.begin(),v.end());}}; ए ए; a.जोड़ें(-1);a.जोड़ें(3);a.जोड़ें(7);a.जोड़ें(-2);a.जोड़ें(5); अदालत A 7 7 B 5 5 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Valid: 3,7,5. max=7. Output: 7. व्याख्या (हिन्दी) मान्य: 3,7,5. अधिकतम=7. आउटपुट: 7. 🎯 Exam Perspective OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class A{int x; public:A(int v=0):x(... What is the output: class A{public:virtual void f(){cou... What is the output: class A{int x=1,y=2,z=3; public:aut... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1796 Question 1796 EN + हिं GB What is the output: class A{int x; public:A(int v):x(v){} int get()const{return x;} A& operator*=(int n){x*=n;return *this;}}; A a(3); a*=2; a*=3; cout< IN आउटपुट क्या है: class A{int x; सार्वजनिक:ए(int v):x(v){} int get()const{return x;} A& ऑपरेटर*=(int n){x*=n;return *this;}}; ए ए(3); ए*=2; ए*=3; अदालत A 18 18 B 6 6 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 3*2=6; 6*3=18. Output: 18. व्याख्या (हिन्दी) 3*2=6; 6*3=18. आउटपुट: 18. 🎯 Exam Perspective Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class A{int x; public:A(int v=0):x(... What is the output: class A{public:virtual void f(){cou... What is the output: class A{vectorv; public:void add(in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1797 Question 1797 EN + हिं GB What is the output: class Safe{int arr[10]={0}; public:int& at(int i){if(i<0||i>=10)throw out_of_range("OOB");return arr[i];}}; Safe s; s.at(3)=42; cout< IN आउटपुट क्या है: class Safe{int arr[10]={0}; public:int& at(int i){if(i=10)throw out_of_range("OOB");return arr[i];}}; सुरक्षित एस; s.at(3)=42; अदालत A 42 42 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) at(3)=42. Output: 42. व्याख्या (हिन्दी) at(3)=42. आउटपुट: 42. 🎯 Exam Perspective अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public:virtual void f()=0;... What is the output: class A{public:virtual void f()=0;... What is the output: class A{vectorv; public:void add(in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1798 Question 1798 EN + हिं GB What is the output: class A{int x=0; public:int get()const{return x;} void reset(){x=0;} A& set(int v){x=v;return *this;}}; A a; cout< IN आउटपुट क्या है: class A{int x=0; सार्वजनिक:int get()const{return x;} void रीसेट(){x=0;} A& set(int v){x=v;return *this;}}; ए ए; अदालत A 50 50 B 55 55 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a.set(5).get()=5; a.reset() (returns void); comma op; a.get()=0. Output: 50. व्याख्या (हिन्दी) a.set(5).get()=5; a.reset() (शून्य रिटर्न); अल्पविराम सेशन; a.get()=0. आउटपुट: 50. 🎯 Exam Perspective OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में 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 int f(){retu... What is the output: class A{int x; public:A(int v=0):x(... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1799 Question 1799 EN + हिं GB What is the output: class A{int x; public:A(int v=0):x(v){} bool isValid()const{return x>=0&&x<=100;} void clip(){if(x<0)x=0;if(x>100)x=100;}}; A a(-5); a.clip(); cout< IN आउटपुट क्या है: class A{int x; सार्वजनिक:A(int v=0):x(v){} bool isValid()const{return x>=0&&x A 1 1 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) clip sets x=0. isValid()=1. Output: 1. व्याख्या (हिन्दी) क्लिप सेट x=0. वैध()=1 है। आउटपुट: 1. 🎯 Exam Perspective यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{int x; public:A(int v):x(v)... What is the output: class A{public:virtual void f()=0;... What is the output: class A{int x=0,y=0; public:void se... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
1800 Question 1800 EN + हिं GB What is the output: class A{int x=1,y=2,z=3; public:auto getAll()const{return make_tuple(x,y,z);}}; A a; auto [x,y,z]=a.getAll(); cout< IN आउटपुट क्या है: class A{int x=1,y=2,z=3; सार्वजनिक:ऑटो getAll()const{return make_tuple(x,y,z);}}; ए ए; ऑटो [x,y,z]=a.getAll(); अदालत A 6 6 B 1 1 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 1+2+3=6. Output: 6. व्याख्या (हिन्दी) 1+2+3=6. आउटपुट: 6. 🎯 Exam Perspective यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 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{int x=0,y=0; public:void se... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)