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 16

EN + हिं
GB What is the difference between array name and pointer?
IN ऐरे नाम और पॉइंटर के बीच क्या अंतर है?
No difference कोई फर्क नहीं
Array name is const pointer; pointer is a variable ऐरे का नाम कॉन्स्ट पॉइंटर है; सूचक एक चर है
Pointer has bounds checking पॉइंटर के पास सीमा जाँच है
Array name can be reassigned ऐरे का नाम पुनः निर्दिष्ट किया जा सकता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Array name decays to a pointer but is not a variable; you cannot assign to it (a=p is illegal).
व्याख्या (हिन्दी) ऐरे का नाम एक पॉइंटर में बदल जाता है लेकिन एक वेरिएबल नहीं है; आप इसे असाइन नहीं कर सकते (a=p अवैध है)।
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 17

EN + हिं
GB What is the output: int a[3]={1,2,3}; cout<<&a+1-&a;
IN आउटपुट क्या है: int a[3]={1,2,3}; अदालत
1 1
3 3
12 12
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &a is of type int(*)[3]. &a+1 advances by sizeof(a)=12. Pointer difference in units of int[3]: result=1.
व्याख्या (हिन्दी) &a int(*)[3] प्रकार का है। &a+1 sizeof(a)=12 के अनुसार आगे बढ़ता है। int[3] की इकाइयों में सूचक अंतर: परिणाम=1।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Arrays" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 18

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

Question 19

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

Question 20

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

Question 21

EN + हिं
GB What happens when you pass an array to a function?
IN जब आप किसी फ़ंक्शन में कोई सरणी पास करते हैं तो क्या होता है?
Array is copied ऐरे की प्रतिलिपि बनाई गई है
Array decays to pointer ऐरे सूचक तक क्षय हो जाता है
Compile error संकलन त्रुटि
Reference is created संदर्भ बनाया गया है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Arrays decay to pointers when passed to functions; the size information is lost.
व्याख्या (हिन्दी) फ़ंक्शंस में पारित होने पर एरे पॉइंटर्स में क्षय हो जाते हैं; आकार की जानकारी खो गई है.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Arrays" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 22

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

Question 23

EN + हिं
GB What is std::array vs raw array in C++?
IN C++ में std::array बनाम raw array क्या है?
std::array has bounds checking always std::array में हमेशा सीमाओं की जांच होती है
std::array knows its size, doesn't decay to pointer std::array अपना आकार जानता है, पॉइंटर तक ख़राब नहीं होता है
Raw arrays are faster always कच्चे ऐरे हमेशा तेज़ होते हैं
std::array uses heap std::array ढेर का उपयोग करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::array is a fixed-size stack-allocated container that maintains size info and has iterators, unlike raw arrays.
व्याख्या (हिन्दी) std::array एक निश्चित आकार का स्टैक-आवंटित कंटेनर है जो आकार की जानकारी रखता है और इसमें कच्चे सरणियों के विपरीत पुनरावर्तक होते हैं।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Arrays" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 24

EN + हिं
GB What is the output: int a[]={10,20,30}; for(int& x:a) x*=2; cout<
IN आउटपुट क्या है: int a[]={10,20,30}; for(int& x:a) x*=2; अदालत
20 20
40 40
30 30
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Range-for with reference doubles each element. a[1]=20*2=40.
व्याख्या (हिन्दी) संदर्भ के साथ रेंज-फॉर प्रत्येक तत्व को दोगुना कर देता है। ए[1]=20*2=40.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Arrays" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 25

EN + हिं
GB What is the output: int a[3]; fill(a,a+3,5); cout<
IN आउटपुट क्या है: int a[3]; भरें(ए,ए+3,5); अदालत
5 5
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::fill fills all elements with 5. a[2]=5.
व्याख्या (हिन्दी) std::fill सभी तत्वों को 5 से भरता है। a[2]=5।
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 26

EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; cout<<*max_element(a,a+5);
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; अदालत
5 5
4 4
3 3
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::max_element returns iterator to max element; *it=5.
व्याख्या (हिन्दी) std::max_element पुनरावर्तक को अधिकतम तत्व पर लौटाता है; *यह=5.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Arrays" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 27

EN + हिं
GB What is 'array decay' in C++?
IN C++ में 'सरणी क्षय' क्या है?
Array converted to pointer when used in most contexts अधिकांश संदर्भों में उपयोग किए जाने पर ऐरे को पॉइंटर में बदल दिया जाता है
Array size reduction सरणी आकार में कमी
Memory deallocation मेमोरी डिलोकेशन
Implicit casting अंतर्निहित कास्टिंग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) In most expressions, array name decays to a pointer to its first element, losing size information.
व्याख्या (हिन्दी) अधिकांश अभिव्यक्तियों में, सरणी नाम एक सूचक से उसके पहले तत्व तक कम हो जाता है, जिससे आकार की जानकारी खो जाती है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Arrays" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 28

EN + हिं
GB What is the output: int a[5]; cout<
IN आउटपुट क्या है: int a[5]; अदालत
20 20 20 20
20 8 20 8
20 4 20 4
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof(a)=20 (5 ints). a+0 causes decay to pointer; sizeof pointer=8 on 64-bit.
व्याख्या (हिन्दी) आकार(ए)=20 (5 इंच)। a+0 पॉइंटर में क्षय का कारण बनता है; 64-बिट पर सूचक का आकार=8।
🎯 Exam Perspective
OOP Using C++ ("Arrays" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 29

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

Question 30

EN + हिं
GB What is the output: int a[3]={1,2,3}; reverse(a,a+3); cout<
IN आउटपुट क्या है: int a[3]={1,2,3}; रिवर्स(ए,ए+3); अदालत
321 321
123 123
132 132
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::reverse reverses in-place: {3,2,1}. Output: 321.
व्याख्या (हिन्दी) std::रिवर्स इन-प्लेस रिवर्स: {3,2,1}। आउटपुट: 321.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Arrays" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।