16 Question 16 EN + हिं GB What is the output: class Shape{public: virtual double perimeter()=0; virtual double area()=0;}; class Rect:public Shape{double w,h; public: Rect(double w,double h):w(w),h(h){} double perimeter(){return 2*(w+h);} double area(){return w*h;}}; Rect r(3,4); cout< IN आउटपुट क्या है: क्लास शेप{पब्लिक: वर्चुअल डबल परिधि()=0; आभासी दोहरा क्षेत्र()=0;}; क्लास रेक्ट:पब्लिक शेप{डबल डब्ल्यू,एच; सार्वजनिक: Rect(double w,double h):w(w),h(h){} डबल परिधि(){रिटर्न 2*(w+h);} डबल एरिया(){रिटर्न w*h;}}; रेक्ट आर(3,4); अदालत A 12 14 12 14 B 12 7 12 7 C 7 12 7 12 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) area=3*4=12, perimeter=2*(3+4)=14. Output: 12 14. व्याख्या (हिन्दी) क्षेत्रफल=3*4=12, परिमाप=2*(3+4)=14। आउटपुट: 12 14. 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is 'abstraction vs implementation' tradeoff? What is 'template method pattern'? What is 'std::any' in C++17? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
17 Question 17 EN + हिं GB What is 'abstraction layer'? IN 'अमूर्त परत' क्या है? A Level of code that hides lower-level details कोड का स्तर जो निचले स्तर के विवरण छुपाता है B Hardware abstraction हार्डवेयर अमूर्तन C OS abstraction ओएस अमूर्तन D All of the above ऊपर के सभी ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Abstraction layers exist at all levels: hardware (OS), OS (standard library), library (application code). व्याख्या (हिन्दी) अमूर्त परतें सभी स्तरों पर मौजूद हैं: हार्डवेयर (ओएस), ओएस (मानक लाइब्रेरी), लाइब्रेरी (एप्लिकेशन कोड)। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is 'std::variant' as abstraction? What is 'abstraction vs implementation' tradeoff? What is 'template method pattern'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
18 Question 18 EN + हिं GB What is 'std::variant' as abstraction? IN अमूर्तन के रूप में 'std::variant' क्या है? A Type-safe union holding one of several types कई प्रकारों में से एक को धारण करने वाला प्रकार-सुरक्षित संघ B Abstract base class सार आधार वर्ग C Template specialization टेम्पलेट विशेषज्ञता D Runtime polymorphism रनटाइम बहुरूपता ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) std::variant can hold one of the specified types, providing type-safe sum type abstraction. व्याख्या (हिन्दी) std::variant निर्दिष्ट प्रकारों में से एक को धारण कर सकता है, जो प्रकार-सुरक्षित योग प्रकार का अमूर्तन प्रदान करता है। 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class Logger{public: virtual void l... What is 'abstraction layer'? What is 'template method pattern'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
19 Question 19 EN + हिं GB What is the output: class Logger{public: virtual void log(string msg)=0;}; class ConsoleLog:public Logger{public: void log(string msg){cout<log("OK"); IN आउटपुट क्या है: क्लास लॉगर {सार्वजनिक: वर्चुअल शून्य लॉग (स्ट्रिंग संदेश) = 0;}; क्लास कंसोललॉग: सार्वजनिक लॉगर {सार्वजनिक: शून्य लॉग (स्ट्रिंग संदेश) {काउट A OK ठीक है B Compile error संकलन त्रुटि C Undefined अपरिभाषित D Nothing कुछ नहीं ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) ConsoleLog implements log(). Polymorphic call prints OK. Output: OK. व्याख्या (हिन्दी) कंसोललॉग लॉग() लागू करता है। बहुरूपी कॉल प्रिंट ठीक है। आउटपुट: ठीक है. 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is 'std::any' in C++17? What is 'non-virtual interface' (NVI) pattern? 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)
20 Question 20 EN + हिं GB What is 'template method pattern'? IN 'टेम्पलेट विधि पैटर्न' क्या है? A Base class defines algorithm skeleton; derived classes fill in steps बेस क्लास एल्गोरिथम कंकाल को परिभाषित करता है; व्युत्पन्न कक्षाएं चरणों में भरती हैं B Using C++ templates C++ टेम्प्लेट का उपयोग करना C Method hiding छुपाने का तरीका D Copy elision एलीशन कॉपी करें ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Template Method: base class has a final method calling virtual steps that subclasses implement. व्याख्या (हिन्दी) टेम्प्लेट विधि: बेस क्लास में वर्चुअल चरणों को कॉल करने की एक अंतिम विधि होती है जिसे उपवर्ग लागू करते हैं। 🎯 Exam Perspective UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: struct Functor{int x; Functor(int v... What is 'duck typing' concept in C++? What is the output: template struct Factorial{static co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
21 Question 21 EN + हिं GB What is the output: template struct Factorial{static const int value=N*Factorial::value;}; template<> struct Factorial<0>{static const int value=1;}; cout<::value; IN आउटपुट क्या है: टेम्पलेट स्ट्रक्चर फ़ैक्टोरियल{static const int value=N*Factorial::value;}; टेम्प्लेट संरचना फ़ैक्टोरियल{स्थैतिक स्थिरांक पूर्णांक मान=1;}; अदालत A 120 120 B 24 24 C 5 5 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) TMP factorial: 5*4*3*2*1=120. Computed at compile time. Output: 120. व्याख्या (हिन्दी) टीएमपी फैक्टोरियल: 5*4*3*2*1=120। संकलन समय पर गणना की गई। आउटपुट: 120. 🎯 Exam Perspective अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is 'template method pattern'? What is the output: class Shape{public: virtual double... What is the output: class Logger{public: virtual void l... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
22 Question 22 EN + हिं GB What is 'std::any' in C++17? IN C++17 में 'std::any' क्या है? A Type-safe container for single value of any type किसी भी प्रकार के एकल मान के लिए टाइप-सुरक्षित कंटेनर B Type erasure for any callable किसी भी कॉल करने योग्य के लिए इरेज़र टाइप करें C Universal base class यूनिवर्सल बेस क्लास D Void pointer wrapper शून्य सूचक आवरण ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) std::any holds a value of any type with type safety; use std::any_cast to retrieve the value. व्याख्या (हिन्दी) std::any प्रकार की सुरक्षा के साथ किसी भी प्रकार का मान रखता है; मान पुनर्प्राप्त करने के लिए std::any_cast का उपयोग करें। 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is 'abstraction layer'? What is 'non-virtual interface' (NVI) pattern? What is the output: class Shape{public: virtual double... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
23 Question 23 EN + हिं GB What is 'abstraction vs implementation' tradeoff? IN 'अमूर्तीकरण बनाम कार्यान्वयन' समझौता क्या है? A More abstraction: flexibility + overhead; less: efficiency + rigidity अधिक अमूर्तता: लचीलापन + ओवरहेड; कम: दक्षता + कठोरता B More abstraction is always better अधिक अमूर्तता सदैव बेहतर होती है C Implementation details are irrelevant कार्यान्वयन विवरण अप्रासंगिक हैं D No tradeoff exists कोई समझौता मौजूद नहीं है ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Abstraction enables flexibility and reuse but may incur overhead (virtual dispatch, indirection); direct implementation is faster but less flexible. व्याख्या (हिन्दी) अमूर्तन लचीलेपन और पुन: उपयोग को सक्षम बनाता है लेकिन ओवरहेड (आभासी प्रेषण, अप्रत्यक्ष) हो सकता है; प्रत्यक्ष कार्यान्वयन तेज़ है लेकिन कम लचीला है। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is 'policy-based design'? What is the output: template struct Factorial{static co... What is 'std::variant' as abstraction? 📚 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 Base{public: void interface(){impl();} private: virtual void impl(){cout<<'B';}}; class Der:public Base{private: void impl()override{cout<<'D';}}; Der d; d.interface(); IN आउटपुट क्या है: क्लास बेस {सार्वजनिक: शून्य इंटरफ़ेस() {impl();} निजी: वर्चुअल शून्य impl() {cout A B बी B D डी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) NVI (Non-Virtual Interface): interface() calls virtual impl(). Der overrides impl(). Output: D. व्याख्या (हिन्दी) एनवीआई (नॉन-वर्चुअल इंटरफ़ेस): इंटरफ़ेस() वर्चुअल इम्प्ल() को कॉल करता है। डेर impl() को ओवरराइड करता है। आउटपुट: डी. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is 'abstraction layer'? What is the output: class Shape{public: virtual double... What is the output: class Logger{public: virtual void l... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
25 Question 25 EN + हिं GB What is 'non-virtual interface' (NVI) pattern? IN 'नॉन-वर्चुअल इंटरफ़ेस' (एनवीआई) पैटर्न क्या है? A Public non-virtual function calls private virtual customization point सार्वजनिक गैर-आभासी फ़ंक्शन निजी वर्चुअल अनुकूलन बिंदु को कॉल करता है B Hiding all virtual functions सभी आभासी कार्यों को छुपाया जा रहा है C Abstract base class pattern सार आधार वर्ग पैटर्न D CRTP variant सीआरटीपी वैरिएंट ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) NVI: public interface functions are non-virtual and call private virtual functions, giving base class control over customization. व्याख्या (हिन्दी) एनवीआई: सार्वजनिक इंटरफ़ेस फ़ंक्शंस गैर-वर्चुअल हैं और निजी वर्चुअल फ़ंक्शंस को कॉल करते हैं, जो अनुकूलन पर बेस क्लास नियंत्रण प्रदान करते हैं। 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is 'std::any' in C++17? What is the output: class Base{public: void interface()... What is the output: class Logger{public: virtual void l... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
26 Question 26 EN + हिं GB What is the output: struct Functor{int x; Functor(int v):x(v){} int operator()(int y){return x+y;}}; Functor f(10); cout< IN आउटपुट क्या है: struct functor{int x; फ़ंक्टर(int v):x(v){} int ऑपरेटर()(int y){रिटर्न x+y;}}; फ़ंक्टर f(10); अदालत A 15 15 B 10 10 C 5 5 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) operator() called with y=5: x+y=10+5=15. Output: 15. व्याख्या (हिन्दी) ऑपरेटर() को y=5 के साथ कॉल किया जाता है: x+y=10+5=15। आउटपुट: 15. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'policy-based design'? What is 'std::any' in C++17? What is 'duck typing' concept in C++? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
27 Question 27 EN + हिं GB What is 'policy-based design'? IN 'नीति-आधारित डिज़ाइन' क्या है? A Using template parameters to inject behavior at compile time संकलन समय पर व्यवहार को इंजेक्ट करने के लिए टेम्पलेट पैरामीटर का उपयोग करना B Runtime behavior injection रनटाइम व्यवहार इंजेक्शन C Abstract factory pattern सार फ़ैक्टरी पैटर्न D Dependency injection डिपेंडेंसी इंजेक्शन ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Policy-based design uses templates to compose classes from orthogonal policies at compile time (Alexandrescu's Modern C++ Design). व्याख्या (हिन्दी) नीति-आधारित डिज़ाइन संकलन समय पर ऑर्थोगोनल नीतियों से कक्षाएं बनाने के लिए टेम्पलेट्स का उपयोग करता है (अलेक्जेंड्रेस्कु का आधुनिक सी++ डिज़ाइन)। 🎯 Exam Perspective अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is 'abstraction vs implementation' tradeoff? What is the output: class Logger{public: virtual void l... What is the output: template struct Factorial{static co... 📚 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: virtual void f(){cout<<1;}}; void g(A* a){a->f();} class B:public A{public: void f(){cout<<2;}}; g(new B); IN आउटपुट क्या है: क्लास ए {पब्लिक: वर्चुअल शून्य एफ() {काउट A 1 1 B 2 2 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) g() calls a->f() with virtual dispatch; B::f() returns 2. Output: 2. व्याख्या (हिन्दी) g() वर्चुअल प्रेषण के साथ a->f() को कॉल करता है; B::f() रिटर्न 2. आउटपुट: 2. 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is 'policy-based design'? What is the output: template void print(T v){cout What is the output: template struct Factorial{static co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
29 Question 29 EN + हिं GB What is 'duck typing' concept in C++? IN C++ में 'डक टाइपिंग' अवधारणा क्या है? A If it has the right interface, use it — achieved via templates यदि इसका इंटरफ़ेस सही है, तो इसका उपयोग करें - टेम्प्लेट के माध्यम से प्राप्त किया गया B Runtime type checking रनटाइम प्रकार की जाँच C Dynamic_cast usage डायनामिक_कास्ट उपयोग D Virtual function tables वर्चुअल फ़ंक्शन टेबल ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Templates achieve duck typing: if type T has the required operations, the template compiles — no explicit interface needed. व्याख्या (हिन्दी) टेम्प्लेट डक टाइपिंग प्राप्त करते हैं: यदि टाइप टी में आवश्यक संचालन हैं, तो टेम्प्लेट संकलित होता है - किसी स्पष्ट इंटरफ़ेस की आवश्यकता नहीं है। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Abstraction" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class Shape{public: virtual double... What is 'std::any' in C++17? What is the output: template struct Factorial{static co... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
30 Question 30 EN + हिं GB What is the output: template void print(T v){cout< IN आउटपुट क्या है: टेम्पलेट शून्य प्रिंट (टी वी) {काउट A 42A3.14 42ए3.14 B Compile error संकलन त्रुटि C Undefined अपरिभाषित D 42A3 42ए3 ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Template instantiated for int, char, double. Outputs 42A3.14. Output: 42A3.14. व्याख्या (हिन्दी) इंट, चार, डबल के लिए तत्काल टेम्पलेट। आउटपुट 42A3.14. आउटपुट: 42A3.14. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class Logger{public: virtual void l... What is the output: class Base{public: void interface()... What is 'non-virtual interface' (NVI) pattern? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)