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 91

EN + हिं
GB What is the output: class A{public:vectorv; A(initializer_listil):v(il){}}; A a={1,2,3,4,5}; cout<
IN आउटपुट क्या है: class A{public:vectorv; ए(इनिशियलाइज़र_लिस्टिल):v(il){}}; ए ए={1,2,3,4,5}; अदालत
53 53
51 51
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=5, v[2]=3. Output: 53.
व्याख्या (हिन्दी) आकार=5, वी[2]=3. आउटपुट: 53.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 92

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

Question 93

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

Question 94

EN + हिं
GB What is the output: class A{public:int x=42; A()=default;}; A a{}; cout<
IN आउटपुट क्या है: class A{public:int x=42; ए()=डिफ़ॉल्ट;}; ए ए{}; अदालत
42 42
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Default ctor uses in-class init x=42. Output: 42.
व्याख्या (हिन्दी) डिफ़ॉल्ट ctor इन-क्लास init x=42 का उपयोग करता है। आउटपुट: 42.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 95

EN + हिं
GB What is the output: class A{public:int x,y; A(int a,int b):y(b),x(a+y){}}; A a(1,2); cout<
IN आउटपुट क्या है: class A{public:int x,y; A(int a,int b):y(b),x(a+y){}}; ए ए(1,2); अदालत
Undefined behavior अपरिभाषित व्यवहार
32 32
12 12
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Members init in declaration order: x first, then y. x=a+y where y is uninitialized = UB.
व्याख्या (हिन्दी) सदस्य घोषणा क्रम में आरंभ करते हैं: पहले x, फिर y। x=a+y जहां y आरंभीकृत नहीं है = UB.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 96

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

Question 97

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

Question 98

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

Question 99

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

Question 100

EN + हिं
GB What is the output: class Base{public:Base(){cout<<'B';} ~Base(){cout<<'b';}}; class Der:public Base{public:Der(){cout<<'D';} ~Der(){cout<<'d';}}; Der d;
IN आउटपुट क्या है: क्लास बेस {पब्लिक: बेस() {काउट
BDdb बीडीडीबी
BdDb बीडीडीबी
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) B,D,~d,~b. Output: BDdb.
व्याख्या (हिन्दी) बी,डी,~डी,~बी. आउटपुट: बीडीडीबी.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 101

EN + हिं
GB What is the output: class A{public:int x; A(int v=0):x(v){} A(const A&)=default; A(A&&o)noexcept:x(move(o.x)){o.x=-1;}}; A a(5); A b(move(a)); cout<
IN आउटपुट क्या है: class A{public:int x; A(int v=0):x(v){} A(const A&)=default; A(A&&o)noexcept:x(move(o.x)){o.x=-1;}}; ए ए(5); ए बी(चाल(ए)); अदालत
-15 -15
55 55
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b.x=5; a.x=-1. Output: -15.
व्याख्या (हिन्दी) बी.एक्स=5; a.x=-1. आउटपुट:-15.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Constructors and Destructors" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 102

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

Question 103

EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} void print()const{cout<print(); delete p;
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} void print()const{cout
42 42
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p->print()=42. Output: 42.
व्याख्या (हिन्दी) p->प्रिंट()=42. आउटपुट: 42.
🎯 Exam Perspective
OOP Using C++ ("Constructors and Destructors" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 104

EN + हिं
GB What is the output: struct POD{int x,y,z;}; POD a={1,2,3}; POD b=a; b.x=10; cout<
IN आउटपुट क्या है: struct POD{int x,y,z;}; पीओडी ए={1,2,3}; पीओडी बी=ए; b.x=10; अदालत
110 110
1010 1010
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b is copy; b.x=10 doesn't affect a. Output: 110.
व्याख्या (हिन्दी) बी प्रतिलिपि है; b.x=10 a को प्रभावित नहीं करता है। आउटपुट: 110.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Constructors and Destructors" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 105

EN + हिं
GB What is the output: class A{public:int x=0; A& inc(int n=1){x+=n;return *this;} A& dec(int n=1){x-=n;return *this;}}; A a; a.inc().inc(5).dec(2); cout<
IN आउटपुट क्या है: class A{public:int x=0; A& inc(int n=1){x+=n;return *this;} A& dec(int n=1){x-=n;return *this;}}; ए ए; a.inc().inc(5).dec(2); अदालत
4 4
6 6
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0+1+5-2=4. Output: 4.
व्याख्या (हिन्दी) 0+1+5-2=4. आउटपुट: 4.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Constructors and Destructors" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।