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
46
EN + हिं
GB What is 'extended precision' floating point?
IN 'विस्तारित परिशुद्धता' फ़्लोटिंग पॉइंट क्या है?
A
80-bit x87 FPU format used on x86 x86 पर 80-बिट x87 FPU प्रारूप का उपयोग किया गया है
B
128-bit float 128-बिट फ्लोट
C
Double precision दोहरी सुनिश्चितता
D
Quad precision क्वाड परिशुद्धता
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x87 uses 80-bit extended precision internally; may cause differences when results stored to 64-bit double.
व्याख्या (हिन्दी) x87 आंतरिक रूप से 80-बिट विस्तारित परिशुद्धता का उपयोग करता है; 64-बिट में संग्रहीत परिणाम दोगुने होने पर अंतर हो सकता है।
47
EN + हिं
GB What is the output: auto x=0x1p4; cout<
IN आउटपुट क्या है: ऑटो x=0x1p4; अदालत
A
16 16
B
1 1
C
4 4
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0x1p4 = 1 * 2^4 = 16 (hex float literal). Output: 16.
व्याख्या (हिन्दी) 0x1p4 = 1 * 2^4 = 16 (हेक्स फ्लोट शाब्दिक)। आउटपुट: 16.
48
EN + हिं
GB What is 'thread_local' storage?
IN 'थ्रेड_लोकल' स्टोरेज क्या है?
A
Each thread has own instance of the variable प्रत्येक थ्रेड में वेरिएबल का अपना उदाहरण होता है
B
Shared across threads सभी धागों में साझा किया गया
C
Atomic variable परमाणु चर
D
Stack variable स्टैक वैरिएबल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) thread_local variables are initialized per-thread and destroyed when thread exits.
व्याख्या (हिन्दी) थ्रेड_लोकल वैरिएबल प्रति-थ्रेड प्रारंभ किए जाते हैं और थ्रेड बाहर निकलने पर नष्ट हो जाते हैं।
49
EN + हिं
GB What is the output: int x=5; auto f=[x]()mutable{x+=5; return x;}; cout<
IN आउटपुट क्या है: int x=5; ऑटो f=[x]()mutable{x+=5; वापसी x;}; अदालत
A
105 105
B
1010 1010
C
55 55
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f() has own copy: x=5+5=10. Outer x=5. C++17 unspecified order: may be 105. Output: 105.
व्याख्या (हिन्दी) f() की अपनी प्रति है: x=5+5=10। बाहरी x=5. C++17 अनिर्दिष्ट क्रम: 105 हो सकता है। आउटपुट: 105।
50
EN + हिं
GB What is 'union' size?
IN 'संघ' का आकार क्या है?
A
Size of largest member सबसे बड़े सदस्य का आकार
B
Sum of all members सभी सदस्यों का योग
C
Size of first member प्रथम सदस्य का आकार
D
Compiler-defined संकलक-परिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) union's size is at least the size of its largest member (plus possible padding for alignment).
व्याख्या (हिन्दी) यूनियन का आकार कम से कम उसके सबसे बड़े सदस्य के आकार (साथ ही संरेखण के लिए संभावित पैडिंग) के बराबर है।
51
EN + हिं
GB What is the output: int x=5; cout<
IN आउटपुट क्या है: int x=5; अदालत
A
i मैं
B
int int यहाँ
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) On GCC, typeid(int).name() returns 'i'. Output: i.
व्याख्या (हिन्दी) जीसीसी पर, typeid(int).name() 'i' लौटाता है। आउटपुट: मैं.
52
EN + हिं
GB What is 'std::complex' operations?
IN 'std::complex' ऑपरेशन क्या है?
A
Arithmetic: +,-,*,/ all defined for complex<T> अंकगणित: +,-,*,/ सभी जटिल के लिए परिभाषित
B
Only addition केवल जोड़
C
Only for double केवल दोगुने के लिए
D
Runtime only केवल रनटाइम
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::complex supports +,-,*,/ and functions like abs, arg, polar, real, imag.
व्याख्या (हिन्दी) std::complex +,-,*,/ और एब्स, आर्ग, पोलर, रियल, इमेज जैसे कार्यों का समर्थन करता है।
53
EN + हिं
GB What is the output: int x=5; cout<<(x>0)*x+(x<0)*(-x);
IN आउटपुट क्या है: int x=5; अदालत
A
5 5
C
-5 -5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (1)*5+(0)*(-5)=5. Output: 5.
व्याख्या (हिन्दी) (1)*5+(0)*(-5)=5. आउटपुट: 5.
54
EN + हिं
GB What is 'NaN' in floating point?
IN फ्लोटिंग पॉइंट में 'NaN' क्या है?
A
Not a Number: result of undefined operations like 0.0/0.0 कोई संख्या नहीं: 0.0/0.0 जैसे अपरिभाषित परिचालनों का परिणाम
B
Negative infinity नकारात्मक अनन्तता
C
Very small number बहुत छोटी संख्या
D
Zero शून्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) NaN != NaN is always true; use isnan() to check.
व्याख्या (हिन्दी) NaN != NaN सदैव सत्य है; जांचने के लिए इसनान() का उपयोग करें।
55
EN + हिं
GB What is the output: double x=0.0/0.0; cout<<(x==x);
IN आउटपुट क्या है: डबल x=0.0/0.0; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) NaN != NaN by IEEE 754. Output: 0.
व्याख्या (हिन्दी) NaN != NaN बाय आईईईई 754. आउटपुट: 0.
56
EN + हिं
GB What is 'consteval if' in C++23?
IN C++23 में 'consteval if' क्या है?
A
if consteval: true branch when in constant evaluation context यदि स्थिरता: निरंतर मूल्यांकन संदर्भ में सच्ची शाखा
B
Same as if constexpr कॉन्स्टेक्सपीआर के समान
C
Runtime check रनटाइम जांच
D
A concept संप्रत्यय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) if consteval allows different code for compile-time vs runtime contexts within constexpr functions.
व्याख्या (हिन्दी) यदि कॉन्स्टेवल कॉन्स्टेक्सपीआर फ़ंक्शंस के भीतर संकलन-समय बनाम रनटाइम संदर्भों के लिए अलग-अलग कोड की अनुमति देता है।
57
EN + हिं
GB What is the output: int x=10; cout<<(x>>1)<<(x&1);
IN आउटपुट क्या है: int x=10; cout1)
A
50 50
B
51 51
C
10 10
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10>>1=5, 10&1=0. Output: 50.
व्याख्या (हिन्दी) 10>>1=5, 10&1=0. आउटपुट: 50.
58
EN + हिं
GB What is 'std::in_place_t'?
IN 'std::in_place_t' क्या है?
A
Tag type for in-place construction in optional/variant वैकल्पिक/संस्करण में इन-प्लेस निर्माण के लिए टैग प्रकार
B
A placement new variant एक प्लेसमेंट नया संस्करण
C
A lambda tag एक लैम्ब्डा टैग
D
A concept संप्रत्यय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::in_place enables constructing contained value directly: optional(in_place, args...).
व्याख्या (हिन्दी) std::in_place सीधे निहित मूल्य का निर्माण करने में सक्षम बनाता है: वैकल्पिक (in_place, args...)।
59
EN + हिं
GB What is the output: int x=INT_MIN; cout<<(x<0);
IN आउटपुट क्या है: int x=INT_MIN; अदालत
A
1 1
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INT_MIN is the most negative int; INT_MIN<0=true=1. Output: 1.
व्याख्या (हिन्दी) INT_MIN सबसे नकारात्मक int है; INT_MIN
60
EN + हिं
GB What is 'deduction guide for std::pair'?
IN 'एसटीडी::जोड़ी के लिए कटौती गाइड' क्या है?
A
pair(T,U)->pair<T,U> enables CTAD युग्म(T,U)->युग्म CTAD को सक्षम बनाता है
B
Manual template arg मैनुअल टेम्पलेट तर्क
C
Runtime deduction रनटाइम कटौती
D
Only for same types केवल एक ही प्रकार के लिए
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++17 CTAD: pair p{1, 2.0}; deduces pair via deduction guide.
व्याख्या (हिन्दी) सी++17 सीटीएडी: जोड़ी पी{1, 2.0}; डिडक्शन गाइड के माध्यम से जोड़ी निकाली जाती है।
46–60 of 160