OOP Using C++ — MCQ Practice

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

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

Question 16

EN + हिं
GB What does the 'delete' operator do when called on a null pointer?
IN शून्य पॉइंटर पर कॉल करने पर 'डिलीट' ऑपरेटर क्या करता है?
Undefined behavior अपरिभाषित व्यवहार
Segfault सेगफॉल्ट
Nothing (safe) कुछ भी नहीं (सुरक्षित)
Throws exception अपवाद फेंकता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The C++ standard guarantees that delete on a null pointer is a no-op; it is safe to delete nullptr.
व्याख्या (हिन्दी) C++ मानक गारंटी देता है कि शून्य पॉइंटर पर डिलीट करना नो-ऑप है; nullptr को हटाना सुरक्षित है.
🎯 Exam Perspective
OOP Using C++ ("Operators in C++" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 17

EN + हिं
GB What is operator[] overloaded for in std::vector?
IN std::vector में ऑपरेटर[] ओवरलोडेड क्या है?
Bounds-checked element access सीमा-जांचित तत्व पहुंच
Unchecked element access by index सूचकांक द्वारा अनियंत्रित तत्व पहुंच
Slice operation स्लाइस ऑपरेशन
Iterator creation पुनरावर्तक निर्माण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::vector::operator[] provides unchecked access; use .at() for bounds-checked access.
व्याख्या (हिन्दी) std::vector::operator[] अनियंत्रित पहुंच प्रदान करता है; सीमा-जांचित पहुंच के लिए .at() का उपयोग करें।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Operators in C++" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 18

EN + हिं
GB What is the output: int x=0; cout<<(x=5)<<' '<<(x==5);
IN आउटपुट क्या है: int x=0; अदालत
5 1 5 1
0 0 0 0
5 0 5 0
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (x=5) assigns 5 to x and returns 5. Then x==5 is true=1. Output: 5 1.
व्याख्या (हिन्दी) (x=5) x को 5 निर्दिष्ट करता है और 5 लौटाता है। तब x==5 सत्य=1 है। आउटपुट: 5 1.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Operators in C++" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 19

EN + हिं
GB What is the type of: sizeof expression?
IN अभिव्यक्ति का आकार क्या है?
int int यहाँ
unsigned int अहस्ताक्षरित int
size_t आकार_t
long लंबा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof returns a value of type std::size_t, which is typically an unsigned integer type.
व्याख्या (हिन्दी) sizeof प्रकार std::size_t का मान लौटाता है, जो आम तौर पर एक अहस्ताक्षरित पूर्णांक प्रकार होता है।
🎯 Exam Perspective
OOP Using C++ ("Operators in C++" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 20

EN + हिं
GB What is the output: int a=4,b=2; cout<<(a^=b,b^=a,a^=b)<<' '<
IN आउटपुट क्या है: int a=4,b=2; अदालत
2 2 4 2 2 4
4 2 4 4 2 4
Undefined अपरिभाषित
2 4 2 2 4 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) XOR swap: a^=b(a=6), b^=a(b=4), a^=b(a=2). Final: a=2, b=4. Comma returns last: a=2.
व्याख्या (हिन्दी) XOR स्वैप: a^=b(a=6), b^=a(b=4), a^=b(a=2)। अंतिम: a=2, b=4. अंत में अल्पविराम आता है: a=2.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Operators in C++" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 21

EN + हिं
GB What is the output: cout << (1 << 0) << ' ' << (1 << 1) << ' ' << (1 << 4);
IN आउटपुट क्या है: cout
1 2 16 1 2 16
0 1 4 0 1 4
1 2 8 1 2 8
1 4 16 1 4 16
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<<0=1, 1<<1=2, 1<<4=16.
व्याख्या (हिन्दी) 1
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Operators in C++" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 22

EN + हिं
GB What is the output: bool a=true,b=false; cout<<(a&&b)<<(a||b)<<(!a);
IN आउटपुट क्या है: bool a=true,b=false; अदालत
010 010
011 011
110 110
101 101
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a&&b=false=0, a||b=true=1, !a=false=0. Output: 010.
व्याख्या (हिन्दी) a&&b=false=0, a||b=true=1, !a=false=0. आउटपुट: 010.
🎯 Exam Perspective
OOP Using C++ ("Operators in C++" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 23

EN + हिं
GB What does the :: operator do when used without a left-hand side?
IN बायीं ओर के बिना उपयोग किये जाने पर :: ऑपरेटर क्या करता है?
Accesses global namespace वैश्विक नामस्थान तक पहुँचता है
Causes compile error संकलन त्रुटि का कारण बनता है
Accesses current class वर्तमान कक्षा तक पहुँचता है
Accesses parent namespace पैरेंट नेमस्पेस तक पहुँचता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ::name accesses name in the global namespace, even if a local/class scope shadow exists.
व्याख्या (हिन्दी) ::नाम वैश्विक नामस्थान में नाम तक पहुंचता है, भले ही स्थानीय/वर्ग स्कोप छाया मौजूद हो।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Operators in C++" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 24

EN + हिं
GB What is the output: int x=5; cout<
IN आउटपुट क्या है: int x=5; अदालत
556 556
566 566
Undefined behavior अपरिभाषित व्यवहार
555 555
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Pre-C++17, evaluating x, x++, and x in the same expression without sequencing is undefined behavior.
व्याख्या (हिन्दी) प्री-सी++17, अनुक्रमण के बिना एक ही अभिव्यक्ति में x, x++ और x का मूल्यांकन करना अपरिभाषित व्यवहार है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Operators in C++" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 25

EN + हिं
GB What is the output: int a=10; cout<<(a>5)+(a<20)+(a==10);
IN आउटपुट क्या है: int a=10; अदालत
1 1
2 2
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All three comparisons are true (=1 each): 1+1+1=3.
व्याख्या (हिन्दी) तीनों तुलनाएँ सत्य हैं (=1 प्रत्येक): 1+1+1=3।
🎯 Exam Perspective
OOP Using C++ ("Operators in C++" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 26

EN + हिं
GB Which operator is used for pointer-to-member access?
IN पॉइंटर-टू-मेंबर एक्सेस के लिए किस ऑपरेटर का उपयोग किया जाता है?
-> ->
.* .*
:: ::
& &
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) .* and ->* are pointer-to-member access operators in C++.
व्याख्या (हिन्दी) .* और ->* C++ में पॉइंटर-टू-मेंबर एक्सेस ऑपरेटर हैं।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Operators in C++" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 27

EN + हिं
GB What is the result: int x = 5; x = x > 3 ? x + 1 : x - 1; cout << x;
IN परिणाम क्या है: int x = 5; एक्स = एक्स > 3 ? एक्स + 1 : एक्स - 1; अदालत
4 4
5 5
6 6
7 7
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x>3 is true, so x = x+1 = 6.
व्याख्या (हिन्दी) x>3 सत्य है, इसलिए x = x+1 = 6.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Operators in C++" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 28

EN + हिं
GB What is the output: int a = 5, b = 10; cout << (a < b ? a : b) * 2;
IN आउटपुट क्या है: int a = 5, b = 10; अदालत
10 10
20 20
5 5
15 15
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a
व्याख्या (हिन्दी)
🎯 Exam Perspective
OOP Using C++ ("Operators in C++" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 29

EN + हिं
GB What is the output: cout << 10/3*3;
IN आउटपुट क्या है: cout
10 10
9 9
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Left to right: 10/3=3 (integer), 3*3=9.
व्याख्या (हिन्दी) बाएँ से दाएँ: 10/3=3 (पूर्णांक), 3*3=9।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Operators in C++" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 30

EN + हिं
GB What does overloading operator= return by convention?
IN ओवरलोडिंग ऑपरेटर = कन्वेंशन द्वारा क्या लौटाता है?
void खालीपन
bool बूल
*this (reference to self) *यह (स्वयं का संदर्भ)
const reference स्थिरांक संदर्भ
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) By convention, copy/move assignment operators return a reference to *this to enable chaining: a = b = c.
व्याख्या (हिन्दी) परंपरा के अनुसार, कॉपी/मूव असाइनमेंट ऑपरेटर चेनिंग को सक्षम करने के लिए *इस का संदर्भ लौटाते हैं: ए = बी = सी।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Operators in C++" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।