1 Question 1 EN + हिं GB What is the order of constructor calls in: class A{}; class B:public A{};? IN कंस्ट्रक्टर कॉल का क्रम क्या है: क्लास ए {}; कक्षा बी:सार्वजनिक ए{};? A B then A बी फिर ए B A then B ए फिर बी C Simultaneous समकालिक D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Base class constructor (A) is called before derived class constructor (B). व्याख्या (हिन्दी) बेस क्लास कंस्ट्रक्टर (ए) को व्युत्पन्न क्लास कंस्ट्रक्टर (बी) से पहले कहा जाता है। 🎯 Exam Perspective OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is the output of destructor order for: class A{pub... What is the output: class A{public: int x; A(int v):x(v... What is 'virtual destructor'? 📚 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: A(){cout<<1;} ~A(){cout<<2;}}; A a; IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट A 12 12 B 21 21 C 1 1 D 2 2 ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Constructor prints 1 at creation, destructor prints 2 at end of scope. Output: 12. व्याख्या (हिन्दी) निर्माण के समय कंस्ट्रक्टर 1 प्रिंट करता है, स्कोप के अंत में डिस्ट्रक्टर 2 प्रिंट करता है। आउटपुट: 12. 🎯 Exam Perspective Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Constructors and Destructors" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the order of constructor calls in: class A{}; c... What is 'virtual destructor'? What is the output: class A{public: A(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
3 Question 3 EN + हिं GB What is a 'delegating constructor' in C++11? IN C++11 में 'डेलीगेटिंग कंस्ट्रक्टर' क्या है? A Constructor calling another constructor of same class कंस्ट्रक्टर उसी क्लास के दूसरे कंस्ट्रक्टर को बुला रहा है B Constructor in derived class व्युत्पन्न वर्ग में कंस्ट्रक्टर C Constructor with default args डिफ़ॉल्ट आर्ग के साथ कंस्ट्रक्टर D Virtual constructor वर्चुअल कंस्ट्रक्टर ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A delegating constructor: A():A(0){} — calls A(int) constructor to initialize. व्याख्या (हिन्दी) एक प्रतिनिधि कंस्ट्रक्टर: A():A(0){} - प्रारंभ करने के लिए A(int) कंस्ट्रक्टर को कॉल करता है। 🎯 Exam Perspective अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: A(){cout What is 'virtual destructor'? What is the output of destructor order for: class A{pub... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
4 Question 4 EN + हिं GB What is the output: struct A{int x,y; A(int a=0,int b=0):x(a),y(b){}}; A a(1,2); cout< IN What is the output: struct A{int x,y; A(int a=0,int b=0):x(a),y(b){}}; ए ए(1,2); अदालत A 12 12 B 21 21 C 00 00 D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) x=1, y=2. Output: 12. व्याख्या (हिन्दी) x=1, y=2. आउटपुट: 12. 🎯 Exam Perspective OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: A(){cout What is the output: class A{public: A(){cout What is a 'delegating constructor' in C++11? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
5 Question 5 EN + हिं GB What is the output: class A{public: A(){cout<<'A';} A(const A&){cout<<'C';} ~A(){cout<<'D';}}; A a; A b(a); IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट A ACD एसीडी B ACDD एसीडीडी C AADD AADD D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a: ctor prints A. b(a): copy ctor prints C. End of scope: ~b prints D, ~a prints D (reverse order). Output: ACDD. व्याख्या (हिन्दी) a: ctor प्रिंट A. b(a): कॉपी ctor प्रिंट C. स्कोप का अंत: ~b प्रिंट D, ~a प्रिंट D (रिवर्स ऑर्डर)। आउटपुट: एसीडीडी। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: A(int){cout What is 'RAII constructor'? What is the output: class A{public: int x; A(int v):x(v... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
6 Question 6 EN + हिं GB What is the output of destructor order for: class A{public:~A(){cout<<'A';}}; class B{A a; public:~B(){cout<<'B';}}; B b; IN डिस्ट्रक्टर ऑर्डर का आउटपुट क्या है: क्लास ए{पब्लिक:~ए(){काउट A AB अब B BA बी ० ए C A ए D B बी ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) B's destructor body runs first (prints B), then member a's destructor runs (prints A). Wait — destructor body of B runs first then member destructors. Output: BA. Correcting: B::~B body runs (cout<<'B'), then A::~A runs (cout<<'A'). Output: BA. व्याख्या (हिन्दी) बी का डिस्ट्रक्टर बॉडी पहले चलता है (बी को प्रिंट करता है), फिर सदस्य ए का डिस्ट्रक्टर चलता है (ए को प्रिंट करता है)। रुको - बी का विध्वंसक निकाय पहले चलता है फिर सदस्य विध्वंसक। आउटपुट: बी.ए. सुधार: बी::~बी बॉडी रन (काउट)। 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Constructors and Destructors" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is 'RAII constructor'? What is a 'delegating constructor' in C++11? What is 'member initializer list'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
7 Question 7 EN + हिं GB What is 'member initializer list'? IN 'सदस्य आरंभकर्ता सूची' क्या है? A Syntax for initializing members before constructor body कंस्ट्रक्टर बॉडी से पहले सदस्यों को आरंभ करने के लिए सिंटैक्स B List of member functions सदस्य कार्यों की सूची C Default values in header हेडर में डिफ़ॉल्ट मान D Runtime initialization रनटाइम आरंभीकरण ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) A(int x): member(x){} — initializes member before constructor body executes; required for const/reference members. व्याख्या (हिन्दी) A(int x): सदस्य(x){} - कंस्ट्रक्टर बॉडी निष्पादित होने से पहले सदस्य को आरंभ करता है; कॉन्स्ट/संदर्भ सदस्यों के लिए आवश्यक। 🎯 Exam Perspective OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is 'virtual destructor'? When is default constructor automatically generated? What is the output: class A{public: int x; A(int v):x(v... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
8 Question 8 EN + हिं GB What is the output: class A{public: int x; A(int v):x(v){cout< IN आउटपुट क्या है: क्लास ए {सार्वजनिक: int x; A(int v):x(v){cout A 3-3 3-3 B 33 33 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Constructor prints 3, destructor prints -3. Output: 3-3. व्याख्या (हिन्दी) कंस्ट्रक्टर प्रिंट 3, डिस्ट्रक्टर प्रिंट -3। आउटपुट: 3-3. 🎯 Exam Perspective SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Constructors and Destructors" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is the output: struct A{int x,y; A(int a=0,int b=0... What is the output: class A{public: A(){cout When is default constructor automatically generated? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
9 Question 9 EN + हिं GB When is default constructor automatically generated? IN डिफ़ॉल्ट कंस्ट्रक्टर स्वचालित रूप से कब उत्पन्न होता है? A When no user-defined constructor exists जब कोई उपयोगकर्ता-परिभाषित कंस्ट्रक्टर मौजूद नहीं है B Always हमेशा C Only for POD types केवल POD प्रकारों के लिए D When class has virtual functions जब क्लास में वर्चुअल फ़ंक्शन हों ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) The compiler generates a default constructor only if no user-defined constructors are declared. व्याख्या (हिन्दी) कंपाइलर एक डिफ़ॉल्ट कंस्ट्रक्टर तभी उत्पन्न करता है जब कोई उपयोगकर्ता-परिभाषित कंस्ट्रक्टर घोषित नहीं किया जाता है। 🎯 Exam Perspective अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class A{public: A(){cout What is the output: class A{int x; public: A(int v=5):x... What is a 'delegating constructor' in C++11? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
10 Question 10 EN + हिं GB What is the output: class A{public: A(){cout<<'A';} A(A&&){cout<<'M';} ~A(){cout<<'D';}}; A f(){return A();} A a=f(); IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट A AD विज्ञापन B A ए C AMD एएमडी D AM पूर्वाह्न ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) With mandatory copy elision (C++17), return A() creates the object directly in a; only one constructor call. Output: A (then D at end but question asks for output which includes D): actually output includes D at scope end. AD. व्याख्या (हिन्दी) अनिवार्य कॉपी एलिज़न (सी++17) के साथ, रिटर्न ए() ऑब्जेक्ट को सीधे ए में बनाता है; केवल एक कंस्ट्रक्टर कॉल। आउटपुट: ए (फिर अंत में डी लेकिन प्रश्न आउटपुट के लिए पूछता है जिसमें डी शामिल है): वास्तव में आउटपुट में स्कोप के अंत में डी शामिल है। ई.पू. 🎯 Exam Perspective OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें। 🔗 Related Questions What is the output: struct A{int x,y; A(int a=0,int b=0... What is 'member initializer list'? What is the output: class A{public: A(){cout 📚 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{int x; public: A(int v=5):x(v){} ~A(){cout< IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v=5):x(v){} ~A(){cout A 53 53 B 35 35 C Compile error संकलन त्रुटि D Undefined अपरिभाषित ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a uses default x=5, b uses x=3. Destructors called in reverse: ~b(3) prints 3, ~a(5) prints 5. Output: 35. व्याख्या (हिन्दी) a डिफ़ॉल्ट x=5 का उपयोग करता है, b x=3 का उपयोग करता है। डिस्ट्रक्टर्स को रिवर्स में बुलाया गया: ~बी(3) प्रिंट 3, ~ए(5) प्रिंट 5। आउटपुट: 35। 🎯 Exam Perspective यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें। 🔗 Related Questions What is the output: class B{public:~B(){cout What is 'RAII constructor'? What is 'member initializer list'? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
12 Question 12 EN + हिं GB What is 'virtual destructor'? IN 'वर्चुअल डिस्ट्रक्टर' क्या है? A Destructor called via vtable for proper derived class cleanup उचित व्युत्पन्न क्लास क्लीनअप के लिए डिस्ट्रक्टर को vtable के माध्यम से बुलाया गया B Destructor that can be overridden विध्वंसक जिसे ओवरराइड किया जा सकता है C Pure virtual destructor शुद्ध आभासी विध्वंसक D Destructor for abstract class only केवल अमूर्त वर्ग के लिए विध्वंसक ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Making base class destructor virtual ensures the derived class destructor is called when deleting through a base pointer. व्याख्या (हिन्दी) बेस क्लास डिस्ट्रक्टर को वर्चुअल बनाना सुनिश्चित करता है कि बेस पॉइंटर के माध्यम से हटाते समय व्युत्पन्न क्लास डिस्ट्रक्टर को कॉल किया जाता है। 🎯 Exam Perspective यह प्रश्न OOP Using C++ ("Constructors and Destructors" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें। 🔗 Related Questions What is the output: class A{int x; public: A(int v=5):x... What is a 'delegating constructor' in C++11? What is the output: class B{public:~B(){cout 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
13 Question 13 EN + हिं GB What is the output: class A{public: A(int){cout<<'P';} A(){cout<<'D';}}; A a; A b(1); IN आउटपुट क्या है: क्लास ए {पब्लिक: ए (इंट) {काउट A DP डी पी B PD पी.डी. C DD डीडी D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) a calls default ctor (D), b(1) calls int ctor (P). Output: DP. व्याख्या (हिन्दी) a डिफ़ॉल्ट ctor (D) को कॉल करता है, b(1) int ctor (P) को कॉल करता है। आउटपुट: डीपी. 🎯 Exam Perspective OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो। 🔗 Related Questions What is 'member initializer list'? What is the output of destructor order for: class A{pub... What is a 'delegating constructor' in C++11? 📚 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 B{public:~B(){cout<<'B';}}; class D:public B{public:~D(){cout<<'D';}}; B*p=new D; delete p; IN आउटपुट क्या है: क्लास बी{पब्लिक:~बी(){काउट A DB डाटाबेस B B बी C Undefined behavior (memory leak possible) अपरिभाषित व्यवहार (स्मृति रिसाव संभव) D Compile error संकलन त्रुटि ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) Deleting derived object through non-virtual base pointer is undefined behavior; D's destructor may not be called. व्याख्या (हिन्दी) गैर-वर्चुअल बेस पॉइंटर के माध्यम से व्युत्पन्न ऑब्जेक्ट को हटाना अपरिभाषित व्यवहार है; डी के विध्वंसक को नहीं बुलाया जा सकता है। 🎯 Exam Perspective Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Constructors and Destructors" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें। 🔗 Related Questions What is 'RAII constructor'? What is the output: class A{int x; public: A(int v=5):x... What is the output of destructor order for: class A{pub... 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)
15 Question 15 EN + हिं GB What is 'RAII constructor'? IN 'RAII कंस्ट्रक्टर' क्या है? A Constructor that acquires resources कंस्ट्रक्टर जो संसाधन प्राप्त करता है B Default constructor डिफ़ॉल्ट कंस्ट्रक्टर C Copy constructor कंस्ट्रक्टर कॉपी करें D Template constructor टेम्प्लेट कंस्ट्रक्टर ✅ Correct Answer: 💡 Explanation / व्याख्या Explanation (English) In RAII, the constructor acquires a resource (file, lock, memory) and the destructor releases it. व्याख्या (हिन्दी) RAII में, कंस्ट्रक्टर एक संसाधन (फ़ाइल, लॉक, मेमोरी) प्राप्त करता है और डिस्ट्रक्टर इसे जारी करता है। 🎯 Exam Perspective अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें। 🔗 Related Questions What is the output: struct A{int x,y; A(int a=0,int b=0... What is the order of constructor calls in: class A{}; c... What is a 'delegating constructor' in C++11? 📚 Related Topic Introduction to C++ (187) Variables and Data Types (160) Operators in C++ (163)