46 Question 46 EN + हिं GB What is the output: class Observable{vector> obs; public: void subscribe(function f){obs.push_back(f);} void notify(){for(auto& f:obs) f();}}; Observable o; int x=0; o.subscribe([&]{x++;}); o.subscribe([&]{x+=2;}); o.notify(); cout< IN आउटपुट क्या है: क्लास ऑब्जर्वेबल{वेक्टर ऑब्स; सार्वजनिक: शून्य सदस्यता(फ़ंक्शन f){obs.push_back(f);} शून्य सूचित(){for(auto& f:obs) f();}}; देखने योग्य ओ; int x=0; o.सदस्यता लें([&]{x++;}); o.सदस्यता लें([&]{x+=2;}); o.सूचित करें(); अदालत A 3 3 B 1 1 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) x+=1+2=3. Output: 3. व्याख्या (हिन्दी) x+=1+2=3. आउटपुट: 3. 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: template int sumAll(const Container... What is the output: class Decorator{function f; public:... What is the output: class Transformer{public:virtual in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
47 Question 47 EN + हिं GB What is the output: class Transformer{public:virtual int transform(int x)=0;}; class Double:public Transformer{public:int transform(int x)override{return x*2;}}; class Inc:public Transformer{public:int transform(int x)override{return x+1;}}; vector ts={new Double,new Inc}; int val=5; for(auto t:ts) val=t->transform(val); cout< IN आउटपुट क्या है: क्लास ट्रांसफार्मर {सार्वजनिक: वर्चुअल इंट ट्रांसफॉर्म (इंट x) = 0;}; क्लास डबल:पब्लिक ट्रांसफार्मर{पब्लिक:इंट ट्रांसफॉर्म(इंट x)ओवरराइड{रिटर्न x*2;}}; क्लास इंक:पब्लिक ट्रांसफार्मर{पब्लिक:इंट ट्रांसफॉर्म(इंट एक्स)ओवरराइड{रिटर्न x+1;}}; वेक्टर ts={नया डबल,नया इंक}; int वैल=5; for(auto t:ts) val=t->transform(val); अदालत A 11 11 B 12 12 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 5*2=10, 10+1=11. Output: 11. व्याख्या (हिन्दी) 5*2=10, 10+1=11. आउटपुट: 11. 🎯 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 the output: class Decorator{function f; public:... What is 'interface segregation principle' in C++? 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)
48 Question 48 EN + हिं GB What is the output: class Singleton{static Singleton* inst; Singleton(){} public: static Singleton* get(){if(!inst) inst=new Singleton; return inst;} int x=42;}; Singleton* Singleton::inst=nullptr; cout<x; IN आउटपुट क्या है: वर्ग सिंगलटन{स्थैतिक सिंगलटन* inst; सिंगलटन(){} सार्वजनिक: स्थिर सिंगलटन* get(){if(!inst) inst=new सिंगलटन; वापसी inst;} int x=42;}; सिंगलटन* सिंगलटन::inst=nullptr; अदालत A 42 42 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) First call creates instance; x=42. Output: 42. व्याख्या (हिन्दी) पहली कॉल उदाहरण बनाती है; एक्स=42. आउटपुट: 42. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is 'interface segregation principle' in C++? What is the output: class A{public:virtual void f()=0;}... What is the output: class Pipe{vectorfns; public: Pipe&... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
49 Question 49 EN + हिं GB What is the output: class A{public:virtual void f()=0; virtual ~A()=default;}; auto factory=[](int t)->A*{struct B:A{void f(){cout<<1;}}; struct C:A{void f(){cout<<2;}}; return t?new C:new B;}; auto p=factory(0); p->f(); IN आउटपुट क्या है: class A{public:virtual void f()=0; आभासी ~ए()=डिफ़ॉल्ट;}; ऑटो फ़ैक्टरी=[](int t)->A*{struct B:A{void f(){cout A 1 1 B 2 2 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) t=0: returns B; B::f()=1. Output: 1. व्याख्या (हिन्दी) t=0: रिटर्न बी; बी::एफ()=1. आउटपुट: 1. 🎯 Exam Perspective OOP Using C++ ("Abstraction" 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 the output: class Pipe{vectorfns; public: Pipe&... 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)
50 Question 50 EN + हिं GB What is the output: template int sumAll(const Container& c){int s=0;for(int x:c)s+=x;return s;} vectorv={1,2,3,4,5}; cout< IN आउटपुट क्या है: template int sumAll(const Container& c){int s=0;for(int x:c)s+=x;return s;} वेक्टरv={1,2,3,4,5}; अदालत A 15 15 B 5 5 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 1+2+3+4+5=15. Output: 15. व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15. 🎯 Exam Perspective SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class A{public:virtual void f()=0;... What is the output: class Memo{mapm; public: int f(int... What is the output: class Builder{int x=0,y=0; public:... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
51 Question 51 EN + हिं GB What is the output: class Decorator{function f; public: Decorator(function fn):f(fn){} Decorator add(function g){return {[=](int x){return g(f(x));}};} int call(int x){return f(x);}}; Decorator d{[](int x){return x*2;}}; auto d2=d.add([](int x){return x+1;}); cout< IN आउटपुट क्या है: क्लास डेकोरेटर{फ़ंक्शन f; सार्वजनिक: डेकोरेटर(फ़ंक्शन fn):f(fn){} डेकोरेटर ऐड(फ़ंक्शन g){रिटर्न {[=](int x){रिटर्न g(f(x));}};} int कॉल(int x){रिटर्न f(x);}}; डेकोरेटर d{[](int x){रिटर्न x*2;}}; ऑटो d2=d.add([](int x){रिटर्न x+1;}); अदालत A 11 11 B 10 10 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 5*2=10, 10+1=11. Output: 11. व्याख्या (हिन्दी) 5*2=10, 10+1=11. आउटपुट: 11. 🎯 Exam Perspective अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class Pipe{vectorfns; public: Pipe&... What is the output: class Builder{int x=0,y=0; public:... 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)
52 Question 52 EN + हिं GB What is the output: class A{public:virtual void f()=0;}; class B:public A{public:void f()override{cout< IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल वॉयड f()=0;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: शून्य एफ() ओवरराइड {काउट A 1B 1बी B B बी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) typeid(*this).name() on GCC for B: typically '1B'. Impl-defined. Generally prints type name. व्याख्या (हिन्दी) B के लिए GCC पर typeid(*this).name(): आमतौर पर '1B'। इम्प्लांट-परिभाषित। आम तौर पर नाम प्रकार प्रिंट करता है। 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class Singleton{static Singleton* i... What is the output: class A{public:virtual void f()=0;}... 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)
53 Question 53 EN + हिं GB What is the output: class A{public:virtual void f()=0;}; try{A *p=new struct B:A{void f(){}}{};delete p;}catch(...){} cout<<'X'; IN आउटपुट क्या है: क्लास ए{पब्लिक:वर्चुअल वॉयड f()=0;}; प्रयास करें{A *p=नई संरचना B:A{void f(){}}{};delete p;}catch(...){} cout A Compile error संकलन त्रुटि B X एक्स C Undefined अपरिभाषित D Nothing कुछ नहीं ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Inline struct definition in new is not valid C++. Compile error. व्याख्या (हिन्दी) नई में इनलाइन संरचना परिभाषा मान्य C++ नहीं है। संकलन त्रुटि. 🎯 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 Builder{int x=0,y=0; public:... What is the output: class A{public:virtual int f()const... What is the output: class Memo{mapm; public: int f(int... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
54 Question 54 EN + हिं GB What is the output: class Memo{mapm; public: int f(int n){if(m.count(n))return m[n]; return m[n]=n<=1?n:f(n-1)+f(n-2);}}; Memo memo; cout< IN आउटपुट क्या है: क्लास मेमो{मैपम; सार्वजनिक: int f(int n){if(m.count(n))रिटर्न m[n]; वापसी एम[एन]=एन A 55 55 B 34 34 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Fib(10)=55. Output: 55. व्याख्या (हिन्दी) फ़िब(10)=55. आउटपुट: 55. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class Transformer{public:virtual in... What is the output: class Singleton{static Singleton* i... What is the output: class A{public:virtual int f()const... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
55 Question 55 EN + हिं GB What is the output: class Builder{int x=0,y=0; public: Builder& setX(int v){x=v;return *this;} Builder& setY(int v){y=v;return *this;} int build(){return x+y;}}; cout< IN आउटपुट क्या है: क्लास बिल्डर{int x=0,y=0; सार्वजनिक: Builder& setX(int v){x=v;return *this;} Builder& setY(int v){y=v;return *this;} int build(){return x+y;}}; अदालत 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++ ("Abstraction" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output: class Memo{mapm; public: int f(int... What is the output: class A{public:virtual void f()=0;}... What is the output: class Transformer{public:virtual in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
56 Question 56 EN + हिं GB What is the output: class A{public:virtual int f()const=0;}; class B:public A{int v; public:B(int v):v(v){} int f()const override{return v*v;}}; vector> v; v.push_back(make_unique(3)); v.push_back(make_unique(4)); int s=0; for(auto&p:v)s+=p->f(); cout< IN आउटपुट क्या है: class A{public:virtual int f()const=0;}; कक्षा बी:सार्वजनिक ए{इंट वी; सार्वजनिक:बी(int v):v(v){} int f()const ओवरराइड{रिटर्न v*v;}}; वेक्टर वी; v.push_back(make_unique(3)); v.push_back(make_unique(4)); int s=0; for(auto&p:v)s+=p->f(); अदालत A 25 25 B 7 7 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) 9+16=25. Output: 25. व्याख्या (हिन्दी) 9+16=25. आउटपुट: 25. 🎯 Exam Perspective UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Abstraction" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: class Transformer{public:virtual in... What is the output: class A{public:virtual void f()=0;}... 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)
57 Question 57 EN + हिं GB What is the output: class Pipe{vector>fns; public: Pipe& add(functionf){fns.push_back(f);return *this;} int run(int x){for(auto&f:fns)x=f(x);return x;}}; Pipe p; p.add([](int x){return x*2;}).add([](int x){return x+3;}).add([](int x){return x*x;}); cout< IN आउटपुट क्या है: class Pipe{vectorfns; सार्वजनिक: Pipe& add(functionf){fns.push_back(f);return *this;} int run(int x){for(auto&f:fns)x=f(x);return x;}}; पाइप पी; p.add([](int x){return x*2;}).add([](int x){return x+3;}).add([](int x){return x*x;}); अदालत A 169 169 B 100 100 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) (5*2+3)^2=(10+3)^2=169. Output: 169. व्याख्या (हिन्दी) (5*2+3)^2=(10+3)^2=169. आउटपुट: 169. 🎯 Exam Perspective अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Abstraction" sub-topic) का यह 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 int f()const... What is the output: class Transformer{public:virtual in... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
58 Question 58 EN + हिं GB What is the output: class A{public:virtual void f()=0;}; class B:public A{public:void f()override{cout<<'B';}}; class C:public A{public:void f()override{cout<<'C';}}; map> m; m["b"]=make_unique(); m["c"]=make_unique(); for(auto&[k,v]:m) v->f(); IN आउटपुट क्या है: class A{public:virtual void f()=0;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: शून्य एफ() ओवरराइड {काउट A BC ईसा पूर्व B CB सीबी C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) map ordered: b व्याख्या (हिन्दी) मानचित्र का आदेश दिया गया: बी 🎯 Exam Perspective OOP Using C++ ("Abstraction" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class Observable{vector obs; public... What is the output: class Memo{mapm; public: int f(int... What is the output: class Decorator{function f; public:... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
59 Question 59 EN + हिं GB What is 'interface segregation principle' in C++? IN C++ में 'इंटरफ़ेस पृथक्करण सिद्धांत' क्या है? A Split large interfaces into smaller specific ones बड़े इंटरफ़ेस को छोटे विशिष्ट इंटरफ़ेस में विभाजित करें B Combine all interfaces सभी इंटरफ़ेस को संयोजित करें C Use only abstract classes केवल अमूर्त वर्गों का प्रयोग करें D PIMPL pattern पीआईएमपीएल पैटर्न ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) ISP: clients depend only on interfaces they use; prevents fat interfaces with unused methods. व्याख्या (हिन्दी) आईएसपी: ग्राहक केवल उनके द्वारा उपयोग किए जाने वाले इंटरफेस पर निर्भर करते हैं; अप्रयुक्त तरीकों से वसा इंटरफेस को रोकता है। 🎯 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 the output: class Transformer{public:virtual in... What is the output: class Pipe{vectorfns; public: Pipe&... What is the output: class A{public:virtual int f()const... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
60 Question 60 EN + हिं GB What is the output: class A{public:virtual void f()=0; virtual ~A()=default;}; class B:public A{public:void f()override{cout<<'B';}}; unique_ptr p(new B); p->f(); IN आउटपुट क्या है: class A{public:virtual void f()=0; आभासी ~ए()=डिफ़ॉल्ट;}; कक्षा बी: सार्वजनिक ए {सार्वजनिक: शून्य एफ() ओवरराइड {काउट A B बी B Compile error संकलन त्रुटि C Undefined अपरिभाषित D A ए ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Virtual dispatch: B::f()=B. Output: B. व्याख्या (हिन्दी) आभासी प्रेषण: B::f()=B. आउटपुट: बी. 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Abstraction" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class Transformer{public:virtual in... What is the output: class A{public:virtual int f()const... 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)