OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye.

📚 106 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
106 questions

Question 1

EN + हिं
GB What is the output: class A{public: int x=5;}; A a; cout<
IN आउटपुट क्या है: class A{public: int x=5;}; ए ए; अदालत
5 5
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) In-class member initializer sets x=5. Output: 5.
व्याख्या (हिन्दी) इन-क्लास सदस्य इनिशियलाइज़र x=5 सेट करता है। आउटपुट: 5.
🎯 Exam Perspective
OOP Using C++ ("Classes and Objects" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 2

EN + हिं
GB What is the output: class A{int x; public: A(int v):x(v){} int get(){return x;}}; A a(10); cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v):x(v){} int get(){return x;}}; ए ए(10); अदालत
10 10
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Constructor initializes x=10 via member initializer list. get() returns 10.
व्याख्या (हिन्दी) कंस्ट्रक्टर सदस्य इनिशियलाइज़र सूची के माध्यम से x=10 को इनिशियलाइज़ करता है। get() रिटर्न 10।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Classes and Objects" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 3

EN + हिं
GB What is 'this' pointer?
IN 'यह' सूचक क्या है?
Pointer to current object instance वर्तमान वस्तु उदाहरण के लिए सूचक
Pointer to base class बेस क्लास का सूचक
Global pointer वैश्विक सूचक
Pointer to member function सदस्य फ़ंक्शन के लिए सूचक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'this' is an implicit pointer available inside non-static member functions pointing to the current object.
व्याख्या (हिन्दी) 'यह' एक अंतर्निहित सूचक है जो गैर-स्थैतिक सदस्य फ़ंक्शंस के अंदर उपलब्ध है जो वर्तमान ऑब्जेक्ट की ओर इशारा करता है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Classes and Objects" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 4

EN + हिं
GB What is the output: class A{public: static int x; int y;}; int A::x=5; A a; a.y=10; cout<
IN आउटपुट क्या है: वर्ग ए {सार्वजनिक: स्थिर int x; int y;}; int A::x=5; ए ए; a.y=10; अदालत
510 510
55 55
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A::x=5 (static, class-wide). a.y=10 (instance). Output: 510.
व्याख्या (हिन्दी) A::x=5 (स्थैतिक, वर्ग-व्यापी)। a.y=10 (उदाहरण). आउटपुट: 510.
🎯 Exam Perspective
OOP Using C++ ("Classes and Objects" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 5

EN + हिं
GB What is a 'friend function'?
IN 'मित्र फ़ंक्शन' क्या है?
Function with access to private/protected members निजी/संरक्षित सदस्यों तक पहुंच के साथ कार्य
A member function एक सदस्य समारोह
A virtual function एक आभासी कार्य
A static function एक स्थिर कार्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A friend function declared inside a class can access its private and protected members.
व्याख्या (हिन्दी) किसी क्लास के अंदर घोषित मित्र फ़ंक्शन अपने निजी और संरक्षित सदस्यों तक पहुंच सकता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Classes and Objects" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 6

EN + हिं
GB What is the output: class A{public: int x; A(int v):x(v){} A(const A& a):x(a.x+1){}}; A a(5); A b=a; cout<
IN आउटपुट क्या है: क्लास ए {सार्वजनिक: int x; A(int v):x(v){} A(const A& a):x(a.x+1){}}; ए ए(5); ए बी=ए; अदालत
5 5
6 6
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Copy constructor called: b.x = a.x+1 = 6. Output: 6.
व्याख्या (हिन्दी) कॉपी कंस्ट्रक्टर कहा जाता है: b.x = a.x+1 = 6. आउटपुट: 6.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Classes and Objects" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 7

EN + हिं
GB What is 'object slicing' in C++?
IN C++ में 'ऑब्जेक्ट स्लाइसिंग' क्या है?
Derived object assigned to base: derived part lost व्युत्पन्न वस्तु को आधार सौंपा गया: व्युत्पन्न भाग खो गया
Virtual function optimization वर्चुअल फ़ंक्शन अनुकूलन
Memory fragmentation स्मृति विखंडन
Partial initialization आंशिक आरंभीकरण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) When a derived class object is assigned to a base class object (by value), the derived-specific members are sliced off.
व्याख्या (हिन्दी) जब एक व्युत्पन्न वर्ग ऑब्जेक्ट को बेस क्लास ऑब्जेक्ट (मूल्य के आधार पर) सौंपा जाता है, तो व्युत्पन्न-विशिष्ट सदस्यों को काट दिया जाता है।
🎯 Exam Perspective
OOP Using C++ ("Classes and Objects" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 8

EN + हिं
GB What is the output: class A{public: int x=0; void f(){x++;}}; A a,b; a.f(); cout<
IN आउटपुट क्या है: class A{public: int x=0; शून्य f(){x++;}}; ए ए, बी; a.f(); अदालत
10 10
11 11
00 00
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a and b are separate instances. a.f() increments a.x to 1. b.x unchanged=0. Output: 10.
व्याख्या (हिन्दी) ए और बी अलग-अलग उदाहरण हैं। a.f() a.x को 1 तक बढ़ाता है। b.x अपरिवर्तित=0। आउटपुट: 10.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Classes and Objects" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 9

EN + हिं
GB What is 'operator overloading'?
IN 'ऑपरेटर ओवरलोडिंग' क्या है?
Defining operator behavior for user-defined types उपयोगकर्ता-परिभाषित प्रकारों के लिए ऑपरेटर व्यवहार को परिभाषित करना
Overriding operators at runtime रनटाइम पर ओवरराइडिंग ऑपरेटर
Removing standard operators मानक ऑपरेटरों को हटाना
Calling multiple operators एकाधिक ऑपरेटरों को कॉल करना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Operator overloading allows defining how operators work with user-defined classes.
व्याख्या (हिन्दी) ऑपरेटर ओवरलोडिंग यह परिभाषित करने की अनुमति देता है कि ऑपरेटर उपयोगकर्ता-परिभाषित कक्षाओं के साथ कैसे काम करते हैं।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Classes and Objects" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 10

EN + हिं
GB What is the output: class A{public: A(){cout<<'C';} ~A(){cout<<'D';}}; {A a;}
IN आउटपुट क्या है: क्लास ए {पब्लिक: ए() {काउट
C सी
D डी
CD सीडी
DC डीसी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Constructor prints C, then when block exits, destructor prints D. Output: CD.
व्याख्या (हिन्दी) कंस्ट्रक्टर सी प्रिंट करता है, फिर जब ब्लॉक बाहर निकलता है, तो डिस्ट्रक्टर डी प्रिंट करता है। आउटपुट: सीडी।
🎯 Exam Perspective
OOP Using C++ ("Classes and Objects" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 11

EN + हिं
GB What is a 'copy constructor'?
IN 'कॉपी कंस्ट्रक्टर' क्या है?
Constructor taking const reference to same class कंस्ट्रक्टर उसी क्लास का कॉन्स्ट रेफरेंस ले रहा है
Constructor for arrays सरणियों के लिए कंस्ट्रक्टर
Default constructor डिफ़ॉल्ट कंस्ट्रक्टर
Move constructor कंस्ट्रक्टर को स्थानांतरित करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Copy constructor: A(const A& other) — initializes a new object as a copy of another.
व्याख्या (हिन्दी) कॉपी कंस्ट्रक्टर: ए (कॉन्स्ट ए और अन्य) - एक नई वस्तु को दूसरे की प्रतिलिपि के रूप में प्रारंभ करता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Classes and Objects" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 12

EN + हिं
GB What is 'Rule of Three' in C++?
IN C++ में 'तीन का नियम' क्या है?
If you define destructor/copy-ctor/copy-assign, define all three यदि आप डिस्ट्रक्टर/कॉपी-क्टर/कॉपी-असाइन को परिभाषित करते हैं, तो तीनों को परिभाषित करें
Three constructors per class प्रति कक्षा तीन कंस्ट्रक्टर
Three virtual functions तीन आभासी कार्य
Three inheritance levels तीन वंशानुक्रम स्तर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) If a class needs a user-defined destructor, copy constructor, or copy assignment, it likely needs all three.
व्याख्या (हिन्दी) यदि किसी वर्ग को उपयोगकर्ता-परिभाषित डिस्ट्रक्टर, कॉपी कंस्ट्रक्टर, या कॉपी असाइनमेंट की आवश्यकता होती है, तो उसे संभवतः इन तीनों की आवश्यकता होती है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Classes and Objects" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 13

EN + हिं
GB What is the output: class A{public: int x; A():x(0){} A(int v):x(v){}}; A a; cout<
IN आउटपुट क्या है: क्लास ए {सार्वजनिक: int x; A():x(0){} A(int v):x(v){}}; ए ए; अदालत
1 1
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A a uses default constructor A():x(0). Output: 0.
व्याख्या (हिन्दी) A डिफ़ॉल्ट कंस्ट्रक्टर A():x(0) का उपयोग करता है। आउटपुट: 0.
🎯 Exam Perspective
OOP Using C++ ("Classes and Objects" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 14

EN + हिं
GB What is 'mutable' keyword for class members?
IN कक्षा सदस्यों के लिए 'म्यूटेबल' कीवर्ड क्या है?
Allows member to be modified even in const member functions कॉन्स्ट सदस्य फ़ंक्शंस में भी सदस्य को संशोधित करने की अनुमति देता है
Makes member public सदस्य को सार्वजनिक बनाता है
Makes member static सदस्य को स्थिर बनाता है
Prevents copy नकल रोकता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) mutable allows a data member to be modified inside const member functions.
व्याख्या (हिन्दी) म्यूटेबल एक डेटा सदस्य को कॉन्स्ट सदस्य फ़ंक्शन के अंदर संशोधित करने की अनुमति देता है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Classes and Objects" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 15

EN + हिं
GB What is the output: class A{public: operator int(){return 42;}}; A a; cout<<(int)a;
IN आउटपुट क्या है: क्लास ए {सार्वजनिक: ऑपरेटर int() {रिटर्न 42;}}; ए ए; अदालत
42 42
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) User-defined conversion operator returns 42. (int)a calls it. Output: 42.
व्याख्या (हिन्दी) उपयोगकर्ता-परिभाषित रूपांतरण ऑपरेटर 42 लौटाता है। (int)a इसे कॉल करता है। आउटपुट: 42.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Classes and Objects" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।