16 Question 16 EN + हिं GB What is the output: class A{public: A(int){cout<<'A';}}; class B:public A{public: B():A(0){cout<<'B';}}; B b; IN आउटपुट क्या है: क्लास ए {पब्लिक: ए (इंट) {काउट A AB अब B BA बी ० ए C B बी D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A(0) constructed first (prints A), then B (prints B). Output: AB. व्याख्या (हिन्दी) A(0) ने पहले निर्माण किया (A प्रिंट करता है), फिर B (B प्रिंट करता है)। आउटपुट: एबी. 🎯 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{int x=1; public: int get(){... What is the output: class A{public: void f(){cout What is the output: class A{public: virtual ~A(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
17 Question 17 EN + हिं GB What is 'multiple inheritance' in C++? IN C++ में 'एकाधिक वंशानुक्रम' क्या है? A Class inheriting from more than one base class एक से अधिक बेस क्लास से विरासत में मिला वर्ग B Multiple objects of same class एक ही कक्षा की अनेक वस्तुएँ C Multiple constructor overloads एकाधिक कंस्ट्रक्टर ओवरलोड D Multiple virtual functions एकाधिक आभासी कार्य ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) C++ allows a class to inherit from multiple base classes: class C: public A, public B{}; व्याख्या (हिन्दी) C++ एक क्लास को कई बेस क्लास से इनहेरिट करने की अनुमति देता है: क्लास C: पब्लिक A, पब्लिक B{}; 🎯 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{public: int f(){return 1;}}... What is the output: class A{int x=1; public: int get(){... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
18 Question 18 EN + हिं GB What is the output: class A{public: virtual ~A(){cout<<'A';}}; class B:public A{public: ~B()override{cout<<'B';}}; A*p=new B; delete p; IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल ~ ए() {काउट A AB अब B BA बी ० ए C B बी D A ए ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) delete p: virtual destructor calls B::~B first (prints B), then A::~A (prints A). Output: BA. व्याख्या (हिन्दी) पी हटाएं: वर्चुअल डिस्ट्रक्टर पहले बी::~बी को कॉल करता है (बी प्रिंट करता है), फिर ए::~ए (ए प्रिंट करता है)। आउटपुट: बी.ए. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public: void f(){cout What is the output: class A{public: virtual void f(){co... What is 'protected constructor'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
19 Question 19 EN + हिं GB What is 'abstract class' in C++? IN C++ में 'अमूर्त वर्ग' क्या है? A Class with at least one pure virtual function कम से कम एक शुद्ध आभासी फ़ंक्शन वाला वर्ग B Class with no members बिना किसी सदस्य वाली कक्षा C Class with only virtual functions केवल आभासी कार्यों वाली कक्षा D Template class टेम्पलेट वर्ग ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) An abstract class has at least one pure virtual function (=0) and cannot be directly instantiated. व्याख्या (हिन्दी) एक अमूर्त वर्ग में कम से कम एक शुद्ध वर्चुअल फ़ंक्शन (=0) होता है और इसे सीधे इंस्टेंट नहीं किया जा सकता है। 🎯 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: void f(){cout What is 'protected constructor'? What is 'EBO' (Empty Base Optimization)? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
20 Question 20 EN + हिं GB What is the output: class A{int x=1; public: int get(){return x;}}; class B:private A{public: int f(){return get();}}; B b; cout< IN आउटपुट क्या है: class A{int x=1; सार्वजनिक: int get(){return x;}}; कक्षा बी: निजी ए {सार्वजनिक: int f() {वापसी प्राप्त();}}; बी बी; अदालत A 1 1 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) f() inside B can call get() (accessible via private inheritance). f()=get()=1. Output: 1. व्याख्या (हिन्दी) B के अंदर f() get() (निजी विरासत के माध्यम से पहुंच योग्य) को कॉल कर सकता है। f()=प्राप्त()=1. आउटपुट: 1. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Inheritance" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'protected constructor'? What is the output: class A{public: int x=5;}; class B:... What is the output: class A{public: int f(){return 1;}}... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
21 Question 21 EN + हिं GB What is the output: class A{public: void f(){cout<<'A';}}; class B:public A{using A::f; public: void f(int x){cout<<'B';}}; B b; b.f(); IN आउटपुट क्या है: क्लास ए {सार्वजनिक: शून्य एफ() {काउट A A ए B B बी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) using A::f brings A::f into B's scope. b.f() with no args calls A::f. Output: A. व्याख्या (हिन्दी) A::f का उपयोग करने से A::f B के दायरे में आ जाता है। b.f() बिना किसी तर्क के A::f कॉल करता है। आउटपुट: ए. 🎯 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{int x=1; public: int get(){... What is the output: class A{public: int f(){return 1;}}... What is 'abstract class' in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
22 Question 22 EN + हिं GB What is 'interface' in C++ (no interface keyword)? IN C++ में 'इंटरफ़ेस' क्या है (कोई इंटरफ़ेस कीवर्ड नहीं)? A Abstract class with only pure virtual functions केवल शुद्ध आभासी कार्यों के साथ सार वर्ग B A header file एक हेडर फ़ाइल C A template class एक टेम्पलेट क्लास D A concept (C++20) एक अवधारणा (C++20) ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Interfaces in C++ are simulated using abstract classes with only pure virtual functions and no data members. व्याख्या (हिन्दी) C++ में इंटरफ़ेस केवल शुद्ध वर्चुअल फ़ंक्शंस और बिना किसी डेटा सदस्य के अमूर्त वर्गों का उपयोग करके सिम्युलेटेड होते हैं। 🎯 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: virtual ~A(){cout What is 'multiple inheritance' in C++? What is the output: class A{int x=1; public: int get(){... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
23 Question 23 EN + हिं GB What is the output: class A{public: int x=5;}; class B:public A{}; class C:public A{}; class D:public B,public C{}; D d; cout< IN आउटपुट क्या है: class A{public: int x=5;}; कक्षा बी:सार्वजनिक ए{}; कक्षा सी:सार्वजनिक ए{}; कक्षा डी:सार्वजनिक बी,सार्वजनिक सी{}; डी डी; अदालत A 5 5 B Compile error संकलन त्रुटि C Ambiguous अस्पष्ट D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) d.B::x explicitly accesses B's copy of A::x = 5. Output: 5. व्याख्या (हिन्दी) d.B::x स्पष्ट रूप से B की A::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 'interface' in C++ (no interface keyword)? What is 'multiple inheritance' in C++? 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)
24 Question 24 EN + हिं GB What is the output: class A{public: virtual void f(){cout<<'A';} virtual void g(){cout<<'G';}}; class B:public A{public: void f()override{cout<<'B';}}; A*p=new B; p->g(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A G जी B A ए C B बी D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B does not override g(), so A::g() is called via vtable. Output: G. व्याख्या (हिन्दी) B, g() को ओवरराइड नहीं करता है, इसलिए A::g() को vtable के माध्यम से कॉल किया जाता है। आउटपुट: जी. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public: void f(){cout What is 'using declaration' in derived class context? What is the output: class A{public: int f(){return 1;}}... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
25 Question 25 EN + हिं GB What is 'protected constructor'? IN 'संरक्षित कंस्ट्रक्टर' क्या है? A Constructor callable only from derived classes कंस्ट्रक्टर केवल व्युत्पन्न कक्षाओं से कॉल करने योग्य है B Private constructor निजी निर्माणकर्ता C Virtual constructor वर्चुअल कंस्ट्रक्टर D Default constructor डिफ़ॉल्ट कंस्ट्रक्टर ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A protected constructor prevents direct instantiation but allows derived class constructors to call it. व्याख्या (हिन्दी) एक संरक्षित कंस्ट्रक्टर प्रत्यक्ष इंस्टेंशियेशन को रोकता है लेकिन व्युत्पन्न क्लास कंस्ट्रक्टर्स को इसे कॉल करने की अनुमति देता है। 🎯 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 'abstract class' in C++? What is the output: class A{public: int f(){return 1;}}... What is the output: class A{public: A(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
26 Question 26 EN + हिं GB What is the output: class A{public: int f(){return 1;}}; class B:public A{public: int f(){return 2;}}; A a=B(); cout< IN आउटपुट क्या है: कक्षा ए {सार्वजनिक: int f() {वापसी 1;}}; कक्षा बी:सार्वजनिक ए{सार्वजनिक: int f(){वापसी 2;}}; ए ए=बी(); अदालत A 1 1 B 2 2 C Undefined अपरिभाषित D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Object slicing: B() is sliced to A when assigned to a. a.f() calls A::f()=1. Output: 1. व्याख्या (हिन्दी) ऑब्जेक्ट स्लाइसिंग: जब ए को सौंपा जाता है तो बी() को ए में स्लाइस किया जाता है। a.f() A::f()=1 को कॉल करता है। आउटपुट: 1. 🎯 Exam Perspective UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Inheritance" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'protected constructor'? What is 'EBO' (Empty Base Optimization)? 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)
27 Question 27 EN + हिं GB What is 'EBO' (Empty Base Optimization)? IN 'ईबीओ' (खाली आधार अनुकूलन) क्या है? A Empty base class occupies no space in derived class खाली आधार वर्ग व्युत्पन्न वर्ग में कोई स्थान नहीं घेरता B Optimization for virtual functions आभासी कार्यों के लिए अनुकूलन C Base class inlining बेस क्लास इनलाइनिंग D Eliminating base constructors आधार निर्माणकर्ताओं को हटाना ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) EBO allows the compiler to give empty base classes zero size when used as a base, optimizing memory. व्याख्या (हिन्दी) ईबीओ कंपाइलर को मेमोरी को अनुकूलित करते हुए, आधार के रूप में उपयोग किए जाने पर खाली बेस क्लास को शून्य आकार देने की अनुमति देता है। 🎯 Exam Perspective अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Inheritance" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: int x=5;}; class B:... What is 'interface' in C++ (no interface keyword)? What is 'multiple inheritance' in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
28 Question 28 EN + हिं GB What is the output: class A{public: void f(){cout<<1;} virtual void g(){cout<<2;}}; class B:public A{public: void f(){cout<<3;} void g()override{cout<<4;}}; B b; A&r=b; r.f(); r.g(); IN आउटपुट क्या है: क्लास ए {पब्लिक: शून्य एफ() {काउट A 12 12 B 13 13 C 14 14 D 34 34 ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) r.f(): f is non-virtual, static dispatch, calls A::f()=1. r.g(): g is virtual, dynamic dispatch, calls B::g()=4. Output: 14. व्याख्या (हिन्दी) r.f(): f गैर-आभासी, स्थिर प्रेषण है, A::f()=1 को कॉल करता है। r.g(): g आभासी, गतिशील प्रेषण है, B::g()=4 को कॉल करता है। आउटपुट: 14. 🎯 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: A(int){cout What is the output: class A{public: void f(){cout What is 'EBO' (Empty Base Optimization)? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
29 Question 29 EN + हिं GB What is the output: class A{public: A(){cout<<'A';} virtual ~A(){cout<<'a';}}; class B:public A{public: B(){cout<<'B';} ~B(){cout<<'b';}}; B b; IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट A ABba एबीबीए B AaBb आब C ABab अबाब D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Construct: A (prints A), B (prints B). Destruct: ~B (prints b), ~A (prints a). Output: ABba. व्याख्या (हिन्दी) निर्माण: ए (प्रिंट ए), बी (प्रिंट बी)। नष्ट करें: ~बी (बी प्रिंट करता है), ~ए (ए प्रिंट करता है)। आउटपुट: एबीबीए. 🎯 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{public: void f(){cout What is the output: class A{public: int x=5;}; class B:... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
30 Question 30 EN + हिं GB What is 'using declaration' in derived class context? IN व्युत्पन्न वर्ग संदर्भ में 'घोषणा का उपयोग' क्या है? A Brings base class member into derived class scope बेस क्लास सदस्य को व्युत्पन्न क्लास स्कोप में लाता है B Using namespace alias नेमस्पेस उपनाम का उपयोग करना C Type alias उपनाम टाइप करें D Forward declaration अग्रेषित घोषणा ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) using Base::memberName in derived class makes the member accessible under derived class name and affects overload resolution. व्याख्या (हिन्दी) व्युत्पन्न वर्ग में Base::memberName का उपयोग करने से सदस्य व्युत्पन्न वर्ग नाम के तहत पहुंच योग्य हो जाता है और ओवरलोड रिज़ॉल्यूशन को प्रभावित करता है। 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Inheritance" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{public: int f(){return 1;}}... What is 'protected constructor'? What is the output: class A{public: virtual ~A(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)