OOP Using C++ — MCQ Practice

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

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

Question 31

EN + हिं
GB What is 'cohesion' in OOP?
IN OOP में 'सामंजस्य' क्या है?
Degree to which class members relate to single purpose वह डिग्री जिससे वर्ग के सदस्य एकल उद्देश्य से संबंधित हों
Coupling between classes कक्षाओं के बीच युग्मन
Inheritance depth विरासत की गहराई
Number of methods विधियों की संख्या
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) High cohesion means a class has one clear, well-defined responsibility — a good encapsulation quality.
व्याख्या (हिन्दी) उच्च सामंजस्य का मतलब है कि एक वर्ग की एक स्पष्ट, अच्छी तरह से परिभाषित जिम्मेदारी है - एक अच्छी एनकैप्सुलेशन गुणवत्ता।
🎯 Exam Perspective
OOP Using C++ ("Encapsulation" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 32

EN + हिं
GB What is the output: class A{int x=5; public: int get()const{return x;}}; A a; cout<
IN आउटपुट क्या है: class A{int x=5; सार्वजनिक: int get()const{return x;}}; ए ए; अदालत
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) get()=5. Output: 5.
व्याख्या (हिन्दी) प्राप्त करें()=5. आउटपुट: 5.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Encapsulation" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 33

EN + हिं
GB What is the output: class A{int x; public: A(int v=0):x(v){} void inc(){x++;} int get()const{return x;}}; A a(10); for(int i=0;i<5;i++) a.inc(); cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v=0):x(v){} void inc(){x++;} int get()const{return x;}}; ए ए(10); for(int i=0;i
15 15
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10+5=15. Output: 15.
व्याख्या (हिन्दी) 10+5=15. आउटपुट: 15.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Encapsulation" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 34

EN + हिं
GB What is 'PIMPL' benefit for compilation?
IN संकलन के लिए 'पीआईएमपीएल' लाभ क्या है?
Implementation changes don't require recompiling users कार्यान्वयन परिवर्तनों के लिए उपयोगकर्ताओं को पुनः संकलित करने की आवश्यकता नहीं है
Faster runtime तेज़ रनटाइम
Thread safety धागे की सुरक्षा
ABI stability एबीआई स्थिरता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) PIMPL hides implementation details; changing impl doesn't change header; clients don't need recompile.
व्याख्या (हिन्दी) पीआईएमपीएल कार्यान्वयन विवरण छुपाता है; इम्प्लांट बदलने से हेडर नहीं बदलता; ग्राहकों को पुनः संकलन की आवश्यकता नहीं है।
🎯 Exam Perspective
OOP Using C++ ("Encapsulation" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 35

EN + हिं
GB What is the output: class A{int x=0; public: void set(int v){if(v>=0) x=v;} int get()const{return x;}}; A a; a.set(-5); a.set(3); cout<
IN आउटपुट क्या है: class A{int x=0; सार्वजनिक: शून्य सेट(int v){if(v>=0) x=v;} int get()const{return x;}}; ए ए; ए.सेट(-5); ए.सेट(3); अदालत
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) -5 rejected; 3 accepted. x=3. Output: 3.
व्याख्या (हिन्दी) -5 अस्वीकृत; 3 स्वीकृत. एक्स=3. आउटपुट: 3.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Encapsulation" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 36

EN + हिं
GB What is the output: class A{int x; public: A():x(42){} int& ref(){return x;}}; A a; cout<
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A():x(42){} int& ref(){return x;}}; ए ए; अदालत
42 42
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ref()=x=42. Output: 42.
व्याख्या (हिन्दी) रेफरी()=x=42. आउटपुट: 42.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Encapsulation" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 37

EN + हिं
GB What is 'interface' vs 'implementation' in encapsulation?
IN इनकैप्सुलेशन में 'इंटरफ़ेस' बनाम 'कार्यान्वयन' क्या है?
Interface: what client uses; implementation: how it works इंटरफ़ेस: ग्राहक क्या उपयोग करता है; कार्यान्वयन: यह कैसे काम करता है
Same thing एक ही बात
Both public दोनों सार्वजनिक
Both private दोनों निजी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Good encapsulation separates stable public interface from changeable private implementation.
व्याख्या (हिन्दी) अच्छा एनकैप्सुलेशन स्थिर सार्वजनिक इंटरफ़ेस को परिवर्तनशील निजी कार्यान्वयन से अलग करता है।
🎯 Exam Perspective
OOP Using C++ ("Encapsulation" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 38

EN + हिं
GB What is the output: class A{int x=0,y=0; public: void move(int dx,int dy){x+=dx;y+=dy;} int getX()const{return x;} int getY()const{return y;}}; A a; a.move(3,4); a.move(-1,2); cout<
IN आउटपुट क्या है: class A{int x=0,y=0; सार्वजनिक: शून्य चाल(int dx,int dy){x+=dx;y+=dy;} int getX()const{return x;} int getY()const{return y;}}; ए ए; ए.हटो(3,4); ए.मूव(-1,2); अदालत
26 26
34 34
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=0+3-1=2, y=0+4+2=6. Output: 26.
व्याख्या (हिन्दी) x=0+3-1=2, y=0+4+2=6. आउटपुट: 26.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Encapsulation" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 39

EN + हिं
GB What is the output: class A{int x; public: A(int v):x(v){} int getX()const{return x;} A operator+(const A& o)const{return A(x+o.x);}}; A a(3),b(4); cout<<(a+b).getX();
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v):x(v){} int getX()const{return x;} A ऑपरेटर+(const A& o)const{return A(x+o.x);}}; ए ए(3),बी(4); अदालत
7 7
12 12
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3+4=7. Output: 7.
व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Encapsulation" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 40

EN + हिं
GB What is the output: class Counter{int n=0; public: void inc(){n++;} void dec(){n (1, 6, 82, 12, 4, 'What is 'const member function' and const object?
IN आउटपुट क्या है: क्लास काउंटर{int n=0; सार्वजनिक: void inc(){n++;} void dec(){n (1, 6, 82, 12, 4, 'कॉन्स्ट मेंबर फ़ंक्शन' और कॉन्स्ट ऑब्जेक्ट क्या है?
const object can only call const member functions कॉन्स्ट ऑब्जेक्ट केवल कॉन्स्ट सदस्य फ़ंक्शंस को कॉल कर सकता है
const function can modify data कॉन्स्ट फ़ंक्शन डेटा को संशोधित कर सकता है
All functions are const by default सभी फ़ंक्शन डिफ़ॉल्ट रूप से स्थिरांक हैं
Compile error if const संकलित त्रुटि यदि const
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Calling non-const function on const object is a compile error.
व्याख्या (हिन्दी) कॉन्स्ट ऑब्जेक्ट पर नॉन-कॉन्स्ट फ़ंक्शन को कॉल करना एक संकलन त्रुटि है।
🎯 Exam Perspective
OOP Using C++ ("Encapsulation" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 41

EN + हिं
GB What is 'const member function' and const object?
IN 'कॉन्स्ट मेंबर फ़ंक्शन' और कॉन्स्ट ऑब्जेक्ट क्या है?
const object can only call const member functions कॉन्स्ट ऑब्जेक्ट केवल कॉन्स्ट सदस्य फ़ंक्शंस को कॉल कर सकता है
const function can modify data कॉन्स्ट फ़ंक्शन डेटा को संशोधित कर सकता है
All functions are const by default सभी फ़ंक्शन डिफ़ॉल्ट रूप से स्थिरांक हैं
Compile error if const संकलित त्रुटि यदि const
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Calling non-const function on const object is a compile error.
व्याख्या (हिन्दी) कॉन्स्ट ऑब्जेक्ट पर नॉन-कॉन्स्ट फ़ंक्शन को कॉल करना एक संकलन त्रुटि है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Encapsulation" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 42

EN + हिं
GB What is the output: class A{mutable int c=0; public: int get()const{return ++c;}}; const A a; cout<
IN आउटपुट क्या है: class A{mutable int c=0; सार्वजनिक: int get()const{return++c;}}; स्थिरांक ए ए; अदालत
12 12
11 11
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) mutable allows modification in const function. c: 1 then 2. Output: 12.
व्याख्या (हिन्दी) म्यूटेबल कॉन्स्ट फ़ंक्शन में संशोधन की अनुमति देता है। सी: 1 फिर 2. आउटपुट: 12.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Encapsulation" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC, Railway, Banking और State PCS जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 43

EN + हिं
GB What is the output: class A{int x=0; public: void f(A& o){o.x=5;} int get()const{return x;}}; A a,b; a.f(b); cout<
IN आउटपुट क्या है: class A{int x=0; सार्वजनिक: void f(A& o){o.x=5;} int get()const{return x;}}; ए ए, बी; ए.एफ(बी); अदालत
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Member functions can access private members of any instance of same class. b.x=5. Output: 5.
व्याख्या (हिन्दी) सदस्य फ़ंक्शन उसी वर्ग के किसी भी उदाहरण के निजी सदस्यों तक पहुंच सकते हैं। बी.एक्स=5. आउटपुट: 5.
🎯 Exam Perspective
OOP Using C++ ("Encapsulation" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 44

EN + हिं
GB What is the output: class A{int x; public: A(int v):x(v){} bool operator==(const A& o)const{return x==o.x;} bool operator!=(const A& o)const{return !(*this==o);}}; A a(3),b(3),c(4); cout<<(a==b)<<(a!=c);
IN आउटपुट क्या है: class A{int x; सार्वजनिक: A(int v):x(v){} bool ऑपरेटर==(const A& o)const{return x==o.x;} बूल ऑपरेटर!=(const A& o)const{return !(*this==o);}}; ए ए(3),बी(3),सी(4); अदालत
11 11
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3==3=1, 3!=4=1. Output: 11.
व्याख्या (हिन्दी) 3==3=1, 3!=4=1. आउटपुट: 11.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Encapsulation" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 45

EN + हिं
GB What is the output: class A{int x=0; public: class B{A& a; public: B(A& a):a(a){} void f(){a.x=10;}}; int get()const{return x;}}; A a; A::B b(a); b.f(); cout<
IN आउटपुट क्या है: class A{int x=0; सार्वजनिक: वर्ग बी{ए&ए; सार्वजनिक: B(A& a):a(a){} void f(){a.x=10;}}; int get()const{return x;}}; ए ए; ए::बी बी(ए); बी.एफ(); अदालत
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) In C++11+, nested class has access to outer's private members. a.x=10. Output: 10.
व्याख्या (हिन्दी) C++11+ में, नेस्टेड क्लास के पास बाहरी निजी सदस्यों तक पहुंच होती है। a.x=10. आउटपुट: 10.
🎯 Exam Perspective
अगर आप Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Encapsulation" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।