1 Question 1 EN + हिं GB What is 'runtime polymorphism' in C++? IN C++ में 'रनटाइम बहुरूपता' क्या है? A Virtual function dispatch resolved at compile time वर्चुअल फ़ंक्शन प्रेषण संकलन समय पर हल हो गया B Virtual function dispatch resolved at runtime via vtable वर्चुअल फ़ंक्शन डिस्पैच को vtable के माध्यम से रनटाइम पर हल किया गया C Template specialization टेम्पलेट विशेषज्ञता D Function overloading फ़ंक्शन ओवरलोडिंग ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Runtime polymorphism uses vtables: the correct function is selected at runtime based on the actual object type. व्याख्या (हिन्दी) रनटाइम बहुरूपता vtables का उपयोग करता है: वास्तविक ऑब्जेक्ट प्रकार के आधार पर रनटाइम पर सही फ़ंक्शन का चयन किया जाता है। 🎯 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()=0;... What is a 'vtable'? What is RTTI in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
2 Question 2 EN + हिं GB What is the output: class A{public: virtual void f(){cout<<1;}}; class B:public A{public: void f()override{cout<<2;}}; void call(A&a){a.f();} B b; call(b); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 1 1 B 2 2 C 12 12 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a.f() with virtual dispatch calls B::f()=2 when b is passed. Output: 2. व्याख्या (हिन्दी) a.f() with virtual dispatch calls B::f()=2 when b is passed. आउटपुट: 2. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Polymorphism" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What happens when you call a virtual function on a null... What is 'static polymorphism' via templates? What is RTTI in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
3 Question 3 EN + हिं GB What is a 'vtable'? IN 'वीटेबल' क्या है? A Compiler-generated table of virtual function pointers वर्चुअल फ़ंक्शन पॉइंटर्स की कंपाइलर-जनरेटेड तालिका B Variable table परिवर्तनीय तालिका C Virtual template आभासी टेम्पलेट D Value table मूल्य तालिका ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) The vtable (virtual dispatch table) stores pointers to the virtual functions of a class; each polymorphic object has a vptr pointing to its vtable. व्याख्या (हिन्दी) वीटेबल (वर्चुअल डिस्पैच टेबल) किसी क्लास के वर्चुअल फ़ंक्शंस के पॉइंटर्स को संग्रहीत करता है; प्रत्येक बहुरूपी वस्तु में एक vptr होता है जो उसकी व्यवहार्यता की ओर इंगित करता है। 🎯 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(){co... What is the output: class A{public: virtual int f(){ret... What is 'compile-time polymorphism'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
4 Question 4 EN + हिं GB What is the output: class A{public: virtual int f(){return 1;}}; class B:public A{public: int f()override{return 2;}}; class C:public B{public: int f()override{return 3;}}; A*p=new C; cout<f(); IN What is the output: class A{public: virtual int f(){return 1;}}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: int f() ओवरराइड {वापसी 2;}}; कक्षा सी:सार्वजनिक बी{सार्वजनिक: int f()ओवरराइड{वापसी 3;}}; A*p=new C; अदालत A 1 1 B 2 2 C 3 3 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) p->f() dispatches to C::f() (most derived override). Output: 3. व्याख्या (हिन्दी) p->f() C::f() (सबसे व्युत्पन्न ओवरराइड) को भेजता है। आउटपुट: 3. 🎯 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(){co... What is 'runtime polymorphism' in C++? What is RTTI in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
5 Question 5 EN + हिं GB What is 'compile-time polymorphism'? IN 'संकलन-समय बहुरूपता' क्या है? A Templates and function overloading टेम्प्लेट और फ़ंक्शन ओवरलोडिंग B Virtual functions आभासी कार्य C RTTI आरटीटीआई D Dynamic dispatch गतिशील प्रेषण ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Compile-time polymorphism includes function overloading and templates — resolved by compiler, no runtime overhead. व्याख्या (हिन्दी) संकलन-समय बहुरूपता में फ़ंक्शन ओवरलोडिंग और टेम्पलेट शामिल हैं - कंपाइलर द्वारा हल किया गया, कोई रनटाइम ओवरहेड नहीं। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Polymorphism" 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(){co... What is the output: class A{public: virtual void f(){co... 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)
6 Question 6 EN + हिं GB What is the output: class A{public: virtual void f()=0;}; class B:public A{public: void f(){cout<<'B';}}; class C:public A{public: void f(){cout<<'C';}}; A*p[2]={new B,new C}; for(auto x:p) x->f(); IN आउटपुट क्या है: क्लास ए{सार्वजनिक: वर्चुअल शून्य f()=0;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: शून्य एफ() {काउट A BC ईसा पूर्व B CB सीबी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) p[0] is B, f()=B; p[1] is C, f()=C. Output: BC. व्याख्या (हिन्दी) p[0] B है, f()=B; p[1] C है, f()=C. आउटपुट: बी.सी. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Polymorphism" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What happens when you call a virtual function on a null... What is 'static polymorphism' via templates? What is 'compile-time polymorphism'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
7 Question 7 EN + हिं GB What is RTTI in C++? IN C++ में RTTI क्या है? A Run-Time Type Information — dynamic_cast and typeid रन-टाइम प्रकार की जानकारी - डायनामिक_कास्ट और टाइपिड B Runtime Template Instantiation रनटाइम टेम्प्लेट इंस्टेंटिएशन C Reference Type Tracking Interface संदर्भ प्रकार ट्रैकिंग इंटरफ़ेस D Recursive Type Tree Inspection पुनरावर्ती प्रकार वृक्ष निरीक्षण ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) RTTI allows querying the type of an object at runtime via dynamic_cast and typeid. व्याख्या (हिन्दी) आरटीटीआई रनटाइम पर डायनामिक_कास्ट और टाइपआईडी के माध्यम से किसी ऑब्जेक्ट के प्रकार को क्वेरी करने की अनुमति देता है। 🎯 Exam Perspective OOP Using C++ ("Polymorphism" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class A{public: virtual void f(){co... What is a 'vtable'? What is the output: class A{public: virtual void f(){co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
8 Question 8 EN + हिं GB What is 'dynamic_cast' used for? IN 'डायनामिक_कास्ट' का उपयोग किसके लिए किया जाता है? A Safe downcasting of polymorphic types बहुरूपी प्रकारों का सुरक्षित डाउनकास्टिंग B Casting between unrelated types असंबंधित प्रकारों के बीच कास्टिंग C Const removal स्थिरांक हटाना D Pointer arithmetic सूचक अंकगणित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) dynamic_cast safely casts to derived type; returns nullptr (for pointers) or throws std::bad_cast (for references) if cast fails. व्याख्या (हिन्दी) डायनामिक_कास्ट सुरक्षित रूप से व्युत्पन्न प्रकार में बदल जाता है; returns nullptr (for pointers) or throws std::bad_cast (for references) if cast fails. 🎯 Exam Perspective UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Polymorphism" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class A{public: virtual void f(){co... What is RTTI in C++? What happens when you call a virtual function on a null... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
9 Question 9 EN + हिं GB What is the output: class A{public: virtual void f(){cout<<'A';} void g(){f();}}; class B:public A{public: void f()override{cout<<'B';}}; B b; b.g(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A A ए B B बी C AB अब D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) g() calls f() via this->f(); virtual dispatch gives B::f(). Output: B. व्याख्या (हिन्दी) g() इस->f() के माध्यम से f() को कॉल करता है; आभासी प्रेषण B::f() देता है। आउटपुट: बी. 🎯 Exam Perspective अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Polymorphism" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: virtual int f(){ret... What is 'compile-time polymorphism'? What is 'dynamic_cast' used for? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
10 Question 10 EN + हिं GB What is 'static polymorphism' via templates? IN टेम्प्लेट के माध्यम से 'स्थैतिक बहुरूपता' क्या है? A CRTP — behavior customized at compile time via template parameter सीआरटीपी - टेम्पलेट पैरामीटर के माध्यम से संकलन समय पर अनुकूलित व्यवहार B Virtual functions without vtable वीटेबल के बिना आभासी कार्य C Runtime dispatch via templates टेम्प्लेट के माध्यम से रनटाइम प्रेषण D Function overloading only केवल फ़ंक्शन ओवरलोडिंग ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) CRTP (Curiously Recurring Template Pattern) achieves polymorphism without virtual function overhead. व्याख्या (हिन्दी) सीआरटीपी (क्यूरियसली रिकरिंग टेम्प्लेट पैटर्न) वर्चुअल फ़ंक्शन ओवरहेड के बिना बहुरूपता प्राप्त करता है। 🎯 Exam Perspective OOP Using C++ ("Polymorphism" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: virtual int f(){ret... What is 'compile-time polymorphism'? What is 'pure virtual function'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
11 Question 11 EN + हिं GB What is the output: class A{public: virtual void f(){cout<<'A';} virtual ~A(){}}; class B:public A{public: void f()override{cout<<'B';}}; void call(A a){a.f();} B b; call(b); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A A ए B B बी C AB अब D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) call takes A by value — slicing occurs, B's f override is lost. call(b) invokes A::f(). Output: A. व्याख्या (हिन्दी) कॉल ए को मान के आधार पर लेती है - स्लाइसिंग होती है, बी का एफ ओवरराइड खो जाता है। कॉल(बी) ए::एफ() को आमंत्रित करता है। आउटपुट: ए. 🎯 Exam Perspective यह सवाल OOP Using C++ ("Polymorphism" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is 'compile-time polymorphism'? What happens when you call a virtual function on a null... What is RTTI in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
12 Question 12 EN + हिं GB What is the output: class A{public: virtual int f(){return 10;} int g(){return f()*2;}}; class B:public A{public: int f()override{return 20;}}; B b; cout< IN आउटपुट क्या है: क्लास ए {सार्वजनिक: वर्चुअल int f() {रिटर्न 10;} int g() {रिटर्न f()*2;}}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: int f() ओवरराइड {वापसी 20;}}; बी बी; अदालत A 20 20 B 40 40 C 10 10 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) b.g() calls A::g() (not overridden). A::g() calls f(), which is virtual: dispatches to B::f()=20. g()=20*2=40. व्याख्या (हिन्दी) b.g() calls A::g() (not overridden). A::g() f() को कॉल करता है, जो वर्चुअल है: B::f()=20 को भेजता है। जी()=20*2=40. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Polymorphism" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is 'dynamic_cast' used for? What is 'compile-time polymorphism'? What is a 'vtable'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
13 Question 13 EN + हिं GB What happens when you call a virtual function on a null pointer? IN जब आप किसी वर्चुअल फ़ंक्शन को शून्य पॉइंटर पर कॉल करते हैं तो क्या होता है? A Calls base implementation आधार कार्यान्वयन को कॉल करता है B Undefined behavior अपरिभाषित व्यवहार C Runtime exception क्रम अपवाद D Null returned शून्य वापस आ गया ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Calling any function (including virtual) on a null pointer is undefined behavior. व्याख्या (हिन्दी) किसी भी फ़ंक्शन (वर्चुअल सहित) को शून्य पॉइंटर पर कॉल करना अपरिभाषित व्यवहार है। 🎯 Exam Perspective OOP Using C++ ("Polymorphism" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is 'dynamic_cast' used for? What is 'compile-time polymorphism'? What is the output: class A{public: virtual void f(){co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
14 Question 14 EN + हिं GB What is the output: class A{public: virtual void f(){cout<<1;}}; class B:public virtual A{public: void f(){cout<<2;}}; class C:public virtual A{public: void f(){cout<<3;}}; class D:public B,public C{}; D d; d.f(); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 2 2 B 3 3 C Undefined अपरिभाषित D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Both B and C override f(), creating ambiguity for D. D must override f() or explicitly qualify. Compile error. व्याख्या (हिन्दी) बी और सी दोनों एफ() को ओवरराइड करते हैं, जिससे डी के लिए अस्पष्टता पैदा होती है। डी को एफ() को ओवरराइड करना होगा या स्पष्ट रूप से अर्हता प्राप्त करनी होगी। संकलन त्रुटि. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Polymorphism" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'compile-time polymorphism'? What is 'runtime polymorphism' in C++? What is the output: class A{public: virtual int f(){ret... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
15 Question 15 EN + हिं GB What is 'pure virtual function'? IN 'शुद्ध वर्चुअल फ़ंक्शन' क्या है? A virtual void f()=0 — must be overridden in derived class वर्चुअल शून्य f()=0 - व्युत्पन्न वर्ग में ओवरराइड किया जाना चाहिए B Virtual function with empty body खाली बॉडी के साथ वर्चुअल फ़ंक्शन C Function that calls base फ़ंक्शन जो आधार को कॉल करता है D Inline virtual function इनलाइन वर्चुअल फ़ंक्शन ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A pure virtual function (=0) has no implementation in the abstract class and must be overridden in concrete derived classes. व्याख्या (हिन्दी) एक शुद्ध वर्चुअल फ़ंक्शन (=0) का अमूर्त वर्ग में कोई कार्यान्वयन नहीं होता है और इसे ठोस व्युत्पन्न वर्गों में ओवरराइड किया जाना चाहिए। 🎯 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(){co... What is 'static polymorphism' via templates? What is the output: class A{public: virtual void f(){co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)