OOP Using C++ — MCQ Practice

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

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

Question 1

EN + हिं
GB What is the output of: int main(){int x=10; std::cout<
IN इसका आउटपुट क्या है: int main(){int x=10; std::cout
10 12 10 12
10 11 10 11
11 12 11 12
Undefined behavior अपरिभाषित व्यवहार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Evaluating x++ and ++x in the same expression with no sequence point is undefined behavior in C++.
व्याख्या (हिन्दी) बिना किसी अनुक्रम बिंदु के एक ही अभिव्यक्ति में x++ और ++x का मूल्यांकन करना C++ में अपरिभाषित व्यवहार है।
🎯 Exam Perspective
OOP Using C++ ("Introduction to C++" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 2

EN + हिं
GB Which of these is NOT a valid C++ translation phase?
IN इनमें से कौन सा वैध C++ अनुवाद चरण नहीं है?
Trigraph replacement ट्रिग्राफ प्रतिस्थापन
Template instantiation टेम्पलेट इन्स्टेन्शियशन
Preprocessing पूर्वप्रसंस्करण
Linking लिंक करना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Template instantiation is not a named phase in the 9 translation phases defined by the C++ standard.
व्याख्या (हिन्दी) C++ मानक द्वारा परिभाषित 9 अनुवाद चरणों में टेम्प्लेट इन्स्टेन्शियेशन एक नामित चरण नहीं है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Introduction to C++" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 3

EN + हिं
GB What does the One Definition Rule (ODR) state?
IN वन डेफिनिशन रूल (ओडीआर) क्या बताता है?
Every entity must have exactly one definition in the whole program पूरे कार्यक्रम में प्रत्येक इकाई की बिल्कुल एक परिभाषा होनी चाहिए
Every function must be defined before use प्रत्येक फ़ंक्शन को उपयोग से पहले परिभाषित किया जाना चाहिए
Every class must have a constructor प्रत्येक क्लास में एक कंस्ट्रक्टर होना चाहिए
Every variable must be initialized प्रत्येक वेरिएबल को प्रारंभ किया जाना चाहिए
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ODR states each entity (variable, function, class type, etc.) shall be defined no more than once in the entire program, with exceptions for inline and templates.
व्याख्या (हिन्दी) ODR में कहा गया है कि प्रत्येक इकाई (वेरिएबल, फ़ंक्शन, क्लास प्रकार, आदि) को इनलाइन और टेम्प्लेट के अपवादों के साथ, पूरे प्रोग्राम में एक से अधिक बार परिभाषित नहीं किया जाएगा।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Introduction to C++" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 4

EN + हिं
GB What is the size of an empty class in C++?
IN C++ में एक खाली कक्षा का आकार क्या है?
0 bytes 0 बाइट्स
1 byte 1 बाइट
4 bytes 4 बाइट्स
Implementation defined, but at least 1 कार्यान्वयन परिभाषित, लेकिन कम से कम 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The C++ standard requires a non-zero size for distinct objects; in practice compilers use 1 byte for empty classes.
व्याख्या (हिन्दी) C++ मानक को अलग-अलग वस्तुओं के लिए गैर-शून्य आकार की आवश्यकता होती है; व्यवहार में कंपाइलर खाली कक्षाओं के लिए 1 बाइट का उपयोग करते हैं।
🎯 Exam Perspective
OOP Using C++ ("Introduction to C++" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 5

EN + हिं
GB Which statement about #include guard vs pragma once is correct?
IN #इनक्लूड गार्ड बनाम प्रैग्मा वन्स के बारे में कौन सा कथन सही है?
pragma once is standardized in C++17 Pragma को एक बार C++17 में मानकीकृत किया गया है
#include guard is always faster #शामिल गार्ड हमेशा तेज़ होता है
pragma once may fail with identical file copies on different paths प्राग्मा एक बार विभिन्न पथों पर समान फ़ाइल प्रतियों के साथ विफल हो सकता है
They are identical in behavior वे व्यवहार में एक जैसे हैं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) pragma once is not standardized but widely supported; it can fail when the same file is accessible via multiple symlinks/paths.
व्याख्या (हिन्दी) व्यावहारिकता एक बार मानकीकृत नहीं है लेकिन व्यापक रूप से समर्थित है; यह तब विफल हो सकता है जब एक ही फ़ाइल एकाधिक सिम्लिंक/पथों के माध्यम से पहुंच योग्य हो।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Introduction to C++" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 6

EN + हिं
GB What is a 'translation unit' in C++?
IN C++ में 'अनुवाद इकाई' क्या है?
A single .cpp file after preprocessing प्रीप्रोसेसिंग के बाद एक एकल .cpp फ़ाइल
A compiled .obj file एक संकलित .obj फ़ाइल
A single function एक एकल कार्य
A single class definition एकल वर्ग परिभाषा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) A translation unit is the result of preprocessing a source file — the .cpp file plus all its included headers, with macros expanded.
व्याख्या (हिन्दी) एक अनुवाद इकाई एक स्रोत फ़ाइल को प्रीप्रोसेस करने का परिणाम है - .cpp फ़ाइल और इसके सभी शामिल हेडर, मैक्रोज़ के विस्तार के साथ।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Introduction to C++" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 7

EN + हिं
GB What happens when you call a pure virtual function from a constructor?
IN जब आप किसी कंस्ट्रक्टर से शुद्ध वर्चुअल फ़ंक्शन को कॉल करते हैं तो क्या होता है?
Calls the derived class override व्युत्पन्न वर्ग को ओवरराइड कहता है
Undefined behavior अपरिभाषित व्यवहार
Compile error संकलन त्रुटि
Calls the pure virtual, which crashes शुद्ध वर्चुअल को कॉल करता है, जो क्रैश हो जाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Calling a pure virtual function (directly or indirectly) from a constructor or destructor is undefined behavior.
व्याख्या (हिन्दी) किसी कंस्ट्रक्टर या डिस्ट्रक्टर से शुद्ध वर्चुअल फ़ंक्शन (प्रत्यक्ष या अप्रत्यक्ष रूप से) को कॉल करना अपरिभाषित व्यवहार है।
🎯 Exam Perspective
OOP Using C++ ("Introduction to C++" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 8

EN + हिं
GB What is the difference between 'struct' and 'class' in C++?
IN C++ में 'स्ट्रक्चर' और 'क्लास' के बीच क्या अंतर है?
struct cannot have member functions संरचना में सदस्य कार्य नहीं हो सकते
Default access is public in struct, private in class डिफ़ॉल्ट पहुंच संरचना में सार्वजनिक है, कक्षा में निजी है
struct cannot have inheritance संरचना में विरासत नहीं हो सकती
struct is a C feature, class is C++ only struct एक C फीचर है, क्लास केवल C++ है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The only differences are default access specifier (public for struct, private for class) and default inheritance (public for struct, private for class).
व्याख्या (हिन्दी) एकमात्र अंतर डिफ़ॉल्ट एक्सेस विनिर्देशक (संरचना के लिए सार्वजनिक, वर्ग के लिए निजी) और डिफ़ॉल्ट विरासत (संरचना के लिए सार्वजनिक, वर्ग के लिए निजी) हैं।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Introduction to C++" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 9

EN + हिं
GB What does 'extern C' do in C++?
IN C++ में 'एक्सटर्न C' क्या करता है?
Imports C standard library सी मानक पुस्तकालय आयात करता है
Disables name mangling for the declared function घोषित फ़ंक्शन के लिए नाम प्रबंधन अक्षम करता है
Makes function visible only in current file फ़ंक्शन को केवल वर्तमान फ़ाइल में दृश्यमान बनाता है
Enables C linkage for all subsequent code बाद के सभी कोड के लिए C लिंकेज सक्षम करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) extern "C" tells the compiler to use C linkage (no name mangling) so C++ code can link with C compiled code.
व्याख्या (हिन्दी) बाहरी "सी" कंपाइलर को सी लिंकेज (कोई नाम मैंगलिंग नहीं) का उपयोग करने के लिए कहता है ताकि सी++ कोड सी संकलित कोड के साथ लिंक हो सके।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Introduction to C++" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 10

EN + हिं
GB In C++, what is the result of sizeof('A')?
IN C++ में, sizeof('A') का परिणाम क्या है?
1 (always) 1 (हमेशा)
sizeof(int) आकार(पूर्णांक)
4 on most platforms अधिकांश प्लेटफार्मों पर 4
sizeof(char) आकार(चार)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) In C++, character literals have type char, so sizeof('A') == sizeof(char) == 1. (Unlike C where 'A' has type int.)
व्याख्या (हिन्दी) C++ में, वर्ण शाब्दिक का प्रकार char है, इसलिए sizeof('A') == sizeof(char) == 1. (C के विपरीत जहां 'A' का प्रकार int है।)
🎯 Exam Perspective
OOP Using C++ ("Introduction to C++" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 11

EN + हिं
GB What is the output of: cout << (true + true + true);
IN इसका आउटपुट क्या है: कॉउट
true सत्य
1 1
3 3
Compiler error संकलक त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) bool values are promoted to int in arithmetic: true=1, so 1+1+1=3.
व्याख्या (हिन्दी) अंकगणित में बूल मानों को int में पदोन्नत किया जाता है: true=1, इसलिए 1+1+1=3।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Introduction to C++" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 12

EN + हिं
GB Which C++ feature allows a function to have multiple definitions with different parameter types?
IN कौन सी C++ सुविधा किसी फ़ंक्शन को विभिन्न पैरामीटर प्रकारों के साथ एकाधिक परिभाषाएँ देने की अनुमति देती है?
Overriding अधिभावी
Overloading अधिक भार
Templates टेम्पलेट्स
Polymorphism बहुरूपता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Function overloading allows multiple functions with the same name but different parameter lists in the same scope.
व्याख्या (हिन्दी) फ़ंक्शन ओवरलोडिंग एक ही नाम के साथ कई फ़ंक्शन की अनुमति देता है लेकिन एक ही दायरे में विभिन्न पैरामीटर सूचियों की अनुमति देता है।
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Introduction to C++" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 13

EN + हिं
GB What is the output: int x=5; cout << x<<2;
IN आउटपुट क्या है: int x=5; अदालत
20 20
7 7
52 52
Compiler error Compiler error
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) cout << x<<2 is parsed as (cout << x) << 2; which shifts x left by 2 bits: 5 << 2 = 20. Wait — actually cout<
व्याख्या (हिन्दी) अदालत
🎯 Exam Perspective
OOP Using C++ ("Introduction to C++" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 14

EN + हिं
GB Which of the following correctly declares a reference to a pointer to const int?
IN निम्नलिखित में से कौन सही ढंग से const int के लिए एक सूचक के संदर्भ की घोषणा करता है?
int const *&rp इंट कॉन्स्ट *&आरपी
const int* &rp स्थिरांक int* &rp
int *const &rp int * स्थिरांक और आरपी
Both A and B ए और बी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both 'int const *&rp' and 'const int* &rp' declare a reference to a pointer to const int; they are identical.
व्याख्या (हिन्दी) 'int const *&rp' और 'const int* &rp' दोनों const int के लिए एक सूचक का संदर्भ घोषित करते हैं; वे समान हैं.
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Introduction to C++" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 15

EN + हिं
GB What is 'name mangling' in C++?
IN C++ में 'नेम मैंगलिंग' क्या है?
Renaming variables for security सुरक्षा के लिए वेरिएबल का नाम बदलना
Encoding function names with type info for linking लिंक करने के लिए प्रकार की जानकारी के साथ फ़ंक्शन नामों को एन्कोड करना
Obfuscating source code अस्पष्ट स्रोत कोड
Compressing symbol table संपीड़न प्रतीक तालिका
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Name mangling encodes the function's name, parameter types, and namespace into a unique symbol name, enabling function overloading in object files.
व्याख्या (हिन्दी) नेम मैंगलिंग फ़ंक्शन के नाम, पैरामीटर प्रकार और नेमस्पेस को एक अद्वितीय प्रतीक नाम में एन्कोड करता है, जिससे ऑब्जेक्ट फ़ाइलों में फ़ंक्शन ओवरलोडिंग सक्षम हो जाती है।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Introduction to C++" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।