OOP Using C++ — MCQ Practice

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

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

Question 1651

EN + हिं
GB What is the output: int x=5,y=10; int *p=&x; swap(p,*(int**)&y);
IN आउटपुट क्या है: int x=5,y=10; int *p=&x; स्वैप(p,*(int**)&y);
Undefined behavior अपरिभाषित व्यवहार
5 5
Compile error संकलन त्रुटि
10 10
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Casting int* to int** and swapping is UB.
व्याख्या (हिन्दी) Int* को int** में कास्ट करना और स्वैप करना UB है।
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1652

EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; sort(a,a+5); int *it=lower_bound(a,a+5,1); cout<<(it-a);
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; क्रमबद्ध करें(ए,ए+5); पूर्णांक *यह=निचला_बाउंड(ए,ए+5,1); अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,1,3,4,5. First>=1 at index 0. Output: 0.
व्याख्या (हिन्दी) क्रमबद्ध: 1,1,3,4,5. सूचकांक 0 पर प्रथम>=1। आउटपुट: 0।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1653

EN + हिं
GB What is the output: vector v={1,2,3}; auto p=v.data(); p[1]=10; cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3}; ऑटो पी=v.डेटा(); पी[1]=10; अदालत
10 10
2 2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) data() returns pointer to underlying array. p[1]=10 changes v[1]. Output: 10.
व्याख्या (हिन्दी) डेटा() अंतर्निहित सरणी में पॉइंटर लौटाता है। p[1]=10 परिवर्तन v[1]। आउटपुट: 10.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1654

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; auto* p=ranges::max_element(a); cout<<*p;
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; ऑटो* पी=रेंज::मैक्स_एलिमेंट(ए); अदालत
5 5
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=5. Output: 5.
व्याख्या (हिन्दी) अधिकतम=5. आउटपुट: 5.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1655

EN + हिं
GB What is the output: int x=0; auto inc=[&x]()noexcept{x++;}; for(int i=0;i<10;i++) inc(); cout<
IN आउटपुट क्या है: int x=0; ऑटो इंक=[&x]()noexcept{x++;}; for(int i=0;i
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Increments 10 times. Output: 10.
व्याख्या (हिन्दी) 10 गुना वृद्धि. आउटपुट: 10.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1656

EN + हिं
GB What is the output: int a[]={1,2,3}; int (*p)[3]=&a; cout<<(*p)[0]+(*p)[2];
IN आउटपुट क्या है: int a[]={1,2,3}; int (*p)[3]=&a; अदालत
4 4
3 3
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (*p)[0]=1, (*p)[2]=3. 1+3=4. Output: 4.
व्याख्या (हिन्दी) (*पी)[0]=1, (*पी)[2]=3. 1+3=4. आउटपुट: 4.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1657

EN + हिं
GB What is the output: int x=10; auto sp1=make_shared(x); auto sp2=sp1; *sp1=20; cout<<*sp2;
IN आउटपुट क्या है: int x=10; ऑटो sp1=make_shared(x); ऑटो sp2=sp1; *sp1=20; अदालत
20 20
10 10
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sp1 and sp2 share same object. *sp1=20 changes *sp2. Output: 20.
व्याख्या (हिन्दी) sp1 और sp2 एक ही वस्तु साझा करते हैं। *sp1=20 परिवर्तन *sp2. आउटपुट: 20.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1658

EN + हिं
GB What is the output: void f(unique_ptrp){cout<<*p;} f(make_unique(99));
IN आउटपुट क्या है: void f(unique_ptrp){cout
99 99
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_unique moved into f. *p=99. Output: 99.
व्याख्या (हिन्दी) make_unique f में चला गया। *पी=99. आउटपुट: 99.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1659

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; auto it=find(begin(a),end(a),4); *it*=10; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; स्वतः यह=ढूंढें(शुरू(ए),अंत(ए),4); *यह*=10; अदालत
40 40
4 4
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4 at a[3]; *it=40. a[3]=40. Output: 40.
व्याख्या (हिन्दी) 4 पर एक[3]; *यह=40. ए[3]=40. आउटपुट: 40.
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 1660

EN + हिं
GB What is the output: int x=5; auto& r=*make_unique(x); cout<
IN आउटपुट क्या है: int x=5; ऑटो& r=*make_unique(x); अदालत
5 5
Compile error संकलन त्रुटि
Undefined behavior अपरिभाषित व्यवहार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_unique creates temporary; binding ref to dereferenced temporary unique_ptr: UB after statement end. Output: UB.
व्याख्या (हिन्दी) make_unique अस्थायी बनाता है; कथन समाप्ति के बाद संदर्भित अस्थायी अद्वितीय_पीटीआर: यूबी के लिए बाध्यकारी रेफरी। आउटपुट: यूबी.
🎯 Exam Perspective
OOP Using C++ के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 1661

EN + हिं
GB What is the output: int a[]={10,20,30}; int *p=a; cout<
IN आउटपुट क्या है: int a[]={10,20,30}; int *p=a; अदालत
202020 202020
103020 103020
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[1]=*(p+1)=20; 1[p]=*(1+p)=20; *(1+p)=20. Output: 202020.
व्याख्या (हिन्दी) पी[1]=*(पी+1)=20; 1[पी]=*(1+पी)=20; *(1+पी)=20. आउटपुट: 202020.
🎯 Exam Perspective
यह सवाल OOP Using C++ category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 1662

EN + हिं
GB What is the output: int x=5; int *p=new int(*p);
IN आउटपुट क्या है: int x=5; int *p=नया int(*p);
Undefined behavior अपरिभाषित व्यवहार
5 5
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p is uninitialized when *p is evaluated. UB.
व्याख्या (हिन्दी) जब *p का मूल्यांकन किया जाता है तो p अप्रारंभीकृत होता है। यूबी.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 1663

EN + हिं
GB What is the output: int a[]={5,4,3,2,1}; auto f=[](int *b,int *e){while(b
IN आउटपुट क्या है: int a[]={5,4,3,2,1}; ऑटो f=[](int *b,int *e){जबकि(b
54321 54321
12345 12345
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Prints 5,4,3,2,1. Output: 54321.
व्याख्या (हिन्दी) 5,4,3,2,1 प्रिंट करता है। आउटपुट: 54321.
🎯 Exam Perspective
OOP Using C++ से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 1664

EN + हिं
GB What is the output: int x=42; auto wp=weak_ptr{}; {auto sp=make_shared(x); wp=sp; cout<<*wp.lock()<<' ';} cout<
IN आउटपुट क्या है: int x=42; ऑटो wp=weak_ptr{}; {ऑटो एसपी=मेक_शेयर्ड(x); wp=sp; अदालत
42 1 42 1
42 0 42 0
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Inside block: lock=42. After block: expired=1. Output: 42 1.
व्याख्या (हिन्दी) अंदर का ब्लॉक: लॉक=42. ब्लॉक के बाद: समाप्त=1. आउटपुट: 42 1.
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 1665

EN + हिं
GB What is the output: int a[3]={1,2,3}; int *p=a+3; cout<<(p==end(a));
IN आउटपुट क्या है: int a[3]={1,2,3}; int *p=a+3; अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a+3==end(a)=true=1. Output: 1.
व्याख्या (हिन्दी) ए+3==अंत(ए)=सत्य=1. आउटपुट: 1.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।