OOP Using C++ — MCQ Practice

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

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

Question 91

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int n=remove_if(a,a+5,[](int x){return x%2==0;})-a; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int n=remove_if(a,a+5,[](int x){return x%2==0;})-a; अदालत
3 3
2 2
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Removes 2,4. Remaining: 1,3,5 = 3. Output: 3.
व्याख्या (हिन्दी) 2,4 को हटाता है। शेष: 1,3,5 = 3. आउटपुट: 3.
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 92

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

Question 93

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

Question 94

EN + हिं
GB What is the output: vector v={1,2,3}; auto w=v; reverse(w.begin(),w.end()); cout<<(v==w);
IN आउटपुट क्या है: वेक्टर v={1,2,3}; ऑटो w=v; रिवर्स(w.begin(),w.end()); अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v={1,2,3} != {3,2,1}. Output: 0.
व्याख्या (हिन्दी) v={1,2,3} != {3,2,1}. आउटपुट: 0.
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC, Railway, Banking और State PCS में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 95

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<<*(max_element(a,a+5)-1);
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
4 4
5 5
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max is at a+4=&a[4]. a+4-1=&a[3]=4. Output: 4.
व्याख्या (हिन्दी) अधिकतम a+4=&a[4] पर है। a+4-1=&a[3]=4. आउटपुट: 4.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Arrays" sub-topic) category का है, और SSC CGL, IBPS, RRB और State-level परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 96

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

Question 97

EN + हिं
GB What is the output: vector v={1,2,3,4,5}; v.erase(v.begin(),v.begin()+2); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; v.erase(v.begin(),v.begin()+2); अदालत
33 33
13 13
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After erase: {3,4,5}. v[0]=3, size=3. Output: 33.
व्याख्या (हिन्दी) मिटाने के बाद: {3,4,5}। v[0]=3, आकार=3. आउटपुट: 33.
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो Railway, SSC, Banking और Defence परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 98

EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
15 15
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) reduce with no init sums: 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) बिना किसी प्रारंभिक योग के कम करें: 1+2+3+4+5=15। आउटपुट: 15.
🎯 Exam Perspective
SSC, Railway, Banking और State PCS जैसी परीक्षाओं में OOP Using C++ ("Arrays" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 99

EN + हिं
GB What is the output: int a[5]={0}; transform(a,a+5,a,[n=1](int)mutable{return n++;});for(int x:a) cout<
IN आउटपुट क्या है: int a[5]={0}; ट्रांसफॉर्म(ए,ए+5,ए,[एन=1](इंट)म्यूटेबल{रिटर्न एन++;});फॉर(इंट एक्स:ए) कॉउट
12345 12345
00000 00000
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n increments: 1,2,3,4,5. Output: 12345.
व्याख्या (हिन्दी) n वेतन वृद्धि: 1,2,3,4,5. आउटपुट: 12345.
🎯 Exam Perspective
अगर आप SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं, तो OOP Using C++ ("Arrays" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 100

EN + हिं
GB What is 'std::views::as_rvalue' (C++23)?
IN 'std::views::as_rvalue' (C++23) क्या है?
Creates a view that moves elements instead of copying एक ऐसा दृश्य बनाता है जो तत्वों को कॉपी करने के बजाय स्थानांतरित करता है
Same as move चाल के समान
A sort view एक प्रकार का दृश्य
A filter एक फ़िल्टर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) as_rvalue wraps a range so elements are move-yielded; useful for moving from containers.
व्याख्या (हिन्दी) as_rvalue एक श्रेणी को लपेटता है ताकि तत्व स्थानांतरित-उपजित हों; कंटेनरों से ले जाने के लिए उपयोगी।
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे UPSC, SSC, Banking और Police भर्ती में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 101

EN + हिं
GB What is the output: array a; iota(a.begin(),a.end(),1); cout<{});
IN आउटपुट क्या है: array a; iota(a.begin(),a.end(),1); अदालत
15 15
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15.
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Arrays" sub-topic) category का है, और Railway, SSC, Banking और Defence परीक्षाओं के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 102

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

Question 103

EN + हिं
GB What is the output: vector v={2,4,6,8,10}; transform(v.begin(),v.end(),v.begin(),[](int x){return x/2;}); cout<
IN आउटपुट क्या है: वेक्टर v={2,4,6,8,10}; ट्रांसफ़ॉर्म(v.begin(),v.end(),v.begin(),[](int x){रिटर्न x/2;}); अदालत
15 15
51 51
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v={1,2,3,4,5}. v[0]=1,v[4]=5. Output: 15.
व्याख्या (हिन्दी) v={1,2,3,4,5}. v[0]=1,v[4]=5. आउटपुट: 15.
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC CGL, IBPS, RRB और State-level परीक्षाओं की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 104

EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; bool r=is_partitioned(a,a+5,[](int x){return x>2;}); cout<
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; bool r=is_partitioned(a,a+5,[](int x){return x>2;}); अदालत
1 1
Compile error संकलन त्रुटि
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Partition by >2: {3,4,5} should come before {1,1}. But 3>2 then 1 not >2 then 4>2: NOT partitioned. Output: 0.
व्याख्या (हिन्दी) >2 द्वारा विभाजन: {3,4,5} {1,1} से पहले आना चाहिए। लेकिन 3>2 फिर 1 नहीं >2 फिर 4>2: विभाजित नहीं। आउटपुट: 0.
🎯 Exam Perspective
UPSC, SSC, Banking और Police भर्ती जैसी परीक्षाओं में OOP Using C++ ("Arrays" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 105

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