OOP Using C++ — MCQ Practice

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

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

Question 1

EN + हिं
GB What is the output: int x=INT_MIN; cout << -x;
IN आउटपुट क्या है: int x=INT_MIN; अदालत
INT_MAX INT_MAX
INT_MIN INT_MIN
Undefined behavior अपरिभाषित व्यवहार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Negating INT_MIN causes signed integer overflow, which is undefined behavior in C++.
व्याख्या (हिन्दी) INT_MIN को नकारने से हस्ताक्षरित पूर्णांक अतिप्रवाह होता है, जो C++ में अपरिभाषित व्यवहार है।
🎯 Exam Perspective
OOP Using C++ ("Variables and Data Types" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 2

EN + हिं
GB Which type can hold a pointer to any object type?
IN कौन सा प्रकार किसी ऑब्जेक्ट प्रकार पर पॉइंटर रख सकता है?
void* खालीपन*
char* चार*
int* int*
nullptr_t nullptr_t
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) void* is a generic pointer type that can hold a pointer to any object type, though it cannot be dereferenced directly.
व्याख्या (हिन्दी) void* एक सामान्य सूचक प्रकार है जो किसी भी ऑब्जेक्ट प्रकार के लिए सूचक को पकड़ सकता है, हालांकि इसे सीधे संदर्भित नहीं किया जा सकता है।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Variables and Data Types" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 3

EN + हिं
GB What is the value of: auto x = 3.14f; decltype(x) y = 2; cout << sizeof(y);
IN इसका मान क्या है: ऑटो x = 3.14f; decltype(x) y = 2; अदालत
4 4
8 8
2 2
Depends on platform प्लेटफार्म पर निर्भर करता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3.14f is float, so x is float. decltype(x) is float. sizeof(float) = 4.
व्याख्या (हिन्दी) 3.14f फ्लोट है, इसलिए x फ्लोट है। decltype(x) फ्लोट है। आकार(फ्लोट) = 4.
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Variables and Data Types" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 4

EN + हिं
GB What is the difference between int and long in C++?
IN C++ में int और long के बीच क्या अंतर है?
long is always 64-bit long हमेशा 64-बिट होता है
int is always 32-bit int हमेशा 32-बिट होता है
sizeof(long) >= sizeof(int) is guaranteed sizeof(long) >= sizeof(int) की गारंटी है
They are identical वे समान हैं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) The standard only guarantees sizeof(short)<=sizeof(int)<=sizeof(long)<=sizeof(long long). Exact sizes are implementation-defined.
व्याख्या (हिन्दी) मानक केवल आकार(छोटा) की गारंटी देता है
🎯 Exam Perspective
OOP Using C++ ("Variables and Data Types" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे SSC CGL, IBPS, RRB और State-level परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 5

EN + हिं
GB What happens: const int x = 5; int* p = const_cast(&x); *p = 10; cout << x;
IN क्या होता है: const int x = 5; int* p = const_cast(&x); *पी = 10; अदालत
10 10
5 5
Undefined behavior अपरिभाषित व्यवहार
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Modifying a const object through const_cast is undefined behavior; the compiler may cache the value of x as 5.
व्याख्या (हिन्दी) const_cast के माध्यम से किसी const ऑब्जेक्ट को संशोधित करना अपरिभाषित व्यवहार है; कंपाइलर x का मान 5 के रूप में कैश कर सकता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Variables and Data Types" sub-topic) category का है, और UPSC, SSC, Banking और Police भर्ती के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 6

EN + हिं
GB What is the output: int x = 0b1010; cout << x;
IN आउटपुट क्या है: int x = 0b1010; अदालत
1010 1010
10 10
8 8
Compile error (pre C++14) संकलन त्रुटि (पूर्व C++14)
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Binary literals (0b prefix) are supported in C++14+. 0b1010 = 10 in decimal.
व्याख्या (हिन्दी) C++14+ में बाइनरी अक्षर (0b उपसर्ग) समर्थित हैं। 0b1010 = 10 दशमलव में.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Variables and Data Types" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 7

EN + हिं
GB Which of these correctly initializes all elements to zero?
IN इनमें से कौन सभी तत्वों को शून्य पर सही ढंग से प्रारंभ करता है?
int arr[5]; int गिरफ्तारी[5];
int arr[5] = {}; पूर्णांक गिरफ्तारी[5] = {};
int arr[5] = {0}; पूर्णांक गिरफ्तारी[5] = {0};
Both B and C बी और सी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int arr[5]={} and int arr[5]={0} both value-initialize all elements to 0. Plain int arr[5] leaves them uninitialized at block scope.
व्याख्या (हिन्दी) int arr[5]={} और int arr[5]={0} दोनों सभी तत्वों को 0 पर मान-प्रारंभ करते हैं। सादा int arr[5] उन्हें ब्लॉक स्कोप पर अप्रारंभीकृत छोड़ देता है।
🎯 Exam Perspective
OOP Using C++ ("Variables and Data Types" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 8

EN + हिं
GB What is the type of 'nullptr' in C++11?
IN C++11 में 'nullptr' का प्रकार क्या है?
void* खालीपन*
int int यहाँ
std::nullptr_t std::nullptr_t
NULL व्यर्थ
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) nullptr has type std::nullptr_t, which is implicitly convertible to any pointer type or bool.
व्याख्या (हिन्दी) nullptr का प्रकार std::nullptr_t है, जो किसी भी सूचक प्रकार या बूल में अंतर्निहित रूप से परिवर्तनीय है।
🎯 Exam Perspective
SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Variables and Data Types" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 9

EN + हिं
GB What is the output: double d = 1/3; cout << d;
IN आउटपुट क्या है: डबल डी = 1/3; अदालत
0.333333 0.333333
0.0 0.0
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1/3 is integer division (both operands are int), result is 0. Then 0 is assigned to double d, so d = 0.0.
व्याख्या (हिन्दी) 1/3 पूर्णांक विभाजन है (दोनों ऑपरेंड पूर्णांक हैं), परिणाम 0 है। फिर 0 को डबल डी को सौंपा गया है, इसलिए डी = 0.0।
🎯 Exam Perspective
अगर आप UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं, तो OOP Using C++ ("Variables and Data Types" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।

Question 10

EN + हिं
GB What is the result: unsigned char x = 255; x++; cout << x;
IN परिणाम क्या है: अहस्ताक्षरित चार x = 255; एक्स++; अदालत
256 256
255 255
Undefined behavior अपरिभाषित व्यवहार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Unsigned integer overflow is well-defined and wraps around: 255+1 = 0 for unsigned char.
व्याख्या (हिन्दी) अहस्ताक्षरित पूर्णांक अतिप्रवाह अच्छी तरह से परिभाषित है और अहस्ताक्षरित चार के लिए 255+1 = 0 के आसपास लपेटता है।
🎯 Exam Perspective
OOP Using C++ ("Variables and Data Types" sub-topic) के इस प्रश्न को कई प्रतियोगी परीक्षाओं जैसे Railway, SSC, Banking और Defence परीक्षाओं में repeat होते देखा गया है। Concept clarity के लिए explanation section जरूर पढ़ें।

Question 11

EN + हिं
GB What does 'auto' deduce for: auto x = {1,2,3};
IN 'ऑटो' किसके लिए निष्कर्ष निकालता है: ऑटो x = {1,2,3};
int[] int[]
std::vector<int> एसटीडी::वेक्टर
std::initializer_list<int> std::initializer_list
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto with a braced initializer list deduces std::initializer_list.
व्याख्या (हिन्दी) ब्रेस्ड इनिशियलाइज़र सूची के साथ ऑटो std::initializer_list निकालता है।
🎯 Exam Perspective
यह सवाल OOP Using C++ ("Variables and Data Types" sub-topic) category का है, और SSC, Railway, Banking और State PCS के exam pattern में इस तरह के questions common हैं। Answer choose करने के बाद दिया गया explanation जरूर पढ़ें।

Question 12

EN + हिं
GB What is the size of: struct { char a; int b; char c; }?
IN इसका आकार क्या है: struct { char a; पूर्णांक बी; चार सी; }?
6 bytes 6 बाइट्स
12 bytes 12 बाइट्स
Implementation-defined due to padding पैडिंग के कारण कार्यान्वयन-परिभाषित
8 bytes on most platforms अधिकांश प्लेटफ़ॉर्म पर 8 बाइट्स
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Padding is inserted for alignment; on most 32-bit/64-bit platforms this struct is 12 bytes (1+3pad+4+1+3pad), but it is implementation-defined.
व्याख्या (हिन्दी) संरेखण के लिए पैडिंग डाली गई है; on most 32-bit/64-bit platforms this struct is 12 bytes (1+3pad+4+1+3pad), but it is implementation-defined.
🎯 Exam Perspective
यह प्रश्न OOP Using C++ ("Variables and Data Types" sub-topic) की तैयारी करने वाले अभ्यर्थियों के लिए उपयोगी है। इस तरह के प्रश्न अक्सर SSC CGL, IBPS, RRB और State-level परीक्षाओं जैसी परीक्षाओं में पूछे जाते रहे हैं, इसलिए concept और explanation दोनों को ध्यान से समझें, सिर्फ उत्तर याद न करें।

Question 13

EN + हिं
GB Which of these is NOT an integer type in C++?
IN इनमें से कौन सा C++ में पूर्णांक प्रकार नहीं है?
bool बूल
wchar_t wchar_t
float तैरना
char16_t char16_t
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) float is a floating-point type. bool, wchar_t, and char16_t are all integer types in C++.
व्याख्या (हिन्दी) फ्लोट एक फ्लोटिंग-पॉइंट प्रकार है। बूल, wchar_t, और char16_t सभी C++ में पूर्णांक प्रकार हैं।
🎯 Exam Perspective
OOP Using C++ ("Variables and Data Types" sub-topic) से जुड़ा यह सवाल उन students के लिए काम का है जो UPSC, SSC, Banking और Police भर्ती की तैयारी कर रहे हैं। बेहतर होगा कि explanation पढ़कर concept clear करें, ताकि exam में similar प्रश्न आने पर confusion न हो।

Question 14

EN + हिं
GB What is the output: int x=10; int &r=x; r=20; cout<
IN आउटपुट क्या है: int x=10; int &r=x; आर=20; अदालत
10 10
20 20
Undefined अपरिभाषित
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) r is a reference to x. Assigning r=20 changes x to 20.
व्याख्या (हिन्दी) r, x का संदर्भ है। r=20 निर्दिष्ट करने से x 20 में बदल जाता है।
🎯 Exam Perspective
Railway, SSC, Banking और Defence परीक्षाओं जैसी परीक्षाओं में OOP Using C++ ("Variables and Data Types" sub-topic) से सवाल अक्सर पूछे जाते हैं। इसलिए सिर्फ answer रटने के बजाय, नीचे दी गई explanation को ध्यान से पढ़ें और concept समझें।

Question 15

EN + हिं
GB What is 'structured binding' introduced in C++17?
IN C++17 में प्रस्तुत 'संरचित बाइंडिंग' क्या है?
Binding a struct to memory address किसी संरचना को मेमोरी एड्रेस से बाइंड करना
Decomposing an aggregate into named variables किसी समुच्चय को नामित चरों में विघटित करना
Binding references to struct members संरचना सदस्यों के लिए बाध्यकारी संदर्भ
Pointer to struct member संरचना सदस्य के लिए सूचक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto [a,b] = pair; decomposes a pair/tuple/array/struct into individual named variables.
व्याख्या (हिन्दी) ऑटो [ए,बी] = जोड़ी; एक जोड़ी/टुपल/सरणी/संरचना को अलग-अलग नामित चर में विघटित करता है।
🎯 Exam Perspective
अगर आप SSC, Railway, Banking और State PCS की तैयारी कर रहे हैं, तो OOP Using C++ ("Variables and Data Types" sub-topic) का यह topic आपके लिए महत्वपूर्ण है। Exam में accuracy बढ़ाने के लिए हर सवाल की explanation जरूर पढ़ें।