OOP Using C++ — MCQ Practice

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

📚 1915 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
1915 questions
526
EN + हिं
GB What is 'integer literal suffix'?
IN 'पूर्णांक शाब्दिक प्रत्यय' क्या है?
A
L/LL/U/UL/ULL specifying type of literal एल/एलएल/यू/यूएल/यूएलएल शाब्दिक प्रकार निर्दिष्ट करता है
B
Hexadecimal prefix हेक्साडेसिमल उपसर्ग
C
Binary prefix बाइनरी उपसर्ग
D
Octal prefix अष्टक उपसर्ग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 42LL is long long; 42U is unsigned int; 42ULL is unsigned long long.
व्याख्या (हिन्दी) 42LL लंबा लंबा है; 42यू अहस्ताक्षरित पूर्णांक है; 42ULL लंबे समय से अहस्ताक्षरित है।
527
EN + हिं
GB What is the output: int x=10; double y=3; cout<
IN आउटपुट क्या है: int x=10; दोगुना y=3; अदालत
A
3.33333 3.33333
B
3 3
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x promoted to double: 10.0/3.0=3.333... Output: 3.33333.
व्याख्या (हिन्दी) x को दोगुना कर दिया गया: 10.0/3.0=3.333... आउटपुट: 3.33333।
528
EN + हिं
GB What is 'structured binding' for struct?
IN संरचना के लिए 'संरचित बाइंडिंग' क्या है?
A
auto [x,y]=myStruct; binds members to names ऑटो [x,y]=myStruct; सदस्यों को नामों से बांधता है
B
Pointer binding सूचक बाइंडिंग
C
Reference binding संदर्भ बाइंडिंग
D
Runtime only केवल रनटाइम
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++17: struct A{int x,y;}; A a{1,2}; auto [x,y]=a; gives x=1,y=2.
व्याख्या (हिन्दी) सी++17: संरचना ए{int x,y;}; ए ए{1,2}; ऑटो [x,y]=a; x=1,y=2 देता है।
529
EN + हिं
GB What is the output: float f=1.0f/0.0f; cout<
IN आउटपुट क्या है: फ्लोट f=1.0f/0.0f; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Float division by zero gives infinity; isinf=true=1. Output: 1.
व्याख्या (हिन्दी) फ्लोट को शून्य से विभाजित करने पर अनंतता मिलती है; inf=सत्य=1. आउटपुट: 1.
530
EN + हिं
GB What is 'std::monostate'?
IN 'std::monostate' क्या है?
A
Empty type usable as first variant alternative प्रथम प्रकार के विकल्प के रूप में प्रयोग करने योग्य खाली प्रकार
B
A null type एक शून्य प्रकार
C
An empty class एक खाली कक्षा
D
Same as void शून्य के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::variant allows default-constructible variant with empty state.
व्याख्या (हिन्दी) std::variant खाली स्थिति के साथ डिफ़ॉल्ट-निर्माण योग्य संस्करण की अनुमति देता है।
531
EN + हिं
GB What is the output: int x=5; cout<<(x%2==0?"even":"odd")<<' '<
IN आउटपुट क्या है: int x=5; अदालत
A
odd 5 विषम 5
B
even 5 सम 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2=1!=0: odd. Output: odd 5.
व्याख्या (हिन्दी) 5%2=1!=0: विषम। आउटपुट: विषम 5.
532
EN + हिं
GB What is 'std::optional::value_or'?
IN 'std::optional::value_or' क्या है?
A
Returns value if present, else default यदि मौजूद है तो मान लौटाता है, अन्यथा डिफ़ॉल्ट
B
Throws if empty खाली हो तो फेंक देता है
C
Same as *opt *ऑप्ट के समान
D
Converts to bool बूल में परिवर्तित हो जाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) opt.value_or(42) returns opt's value if has_value(), else 42.
व्याख्या (हिन्दी) opt.value_or(42) यदि has_value() है तो opt का मान लौटाता है, अन्यथा 42।
533
EN + हिं
GB What is the output: int x=1000; char c=x; cout<<(int)c;
IN आउटपुट क्या है: int x=1000; चार सी=एक्स; अदालत
A
Impl-defined इम्प्लांट-परिभाषित
B
-24 -24
C
232 232
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1000%256=232 as unsigned; as signed char: 232-256=-24. Implementation-defined.
व्याख्या (हिन्दी) 1000%256=232 अहस्ताक्षरित के रूप में; हस्ताक्षरित वर्ण के अनुसार: 232-256=-24। कार्यान्वयन-परिभाषित।
534
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-बिट में संग्रहीत परिणाम दोगुने होने पर अंतर हो सकता है।
535
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.
536
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.
व्याख्या (हिन्दी) थ्रेड_लोकल वैरिएबल प्रति-थ्रेड प्रारंभ किए जाते हैं और थ्रेड बाहर निकलने पर नष्ट हो जाते हैं।
537
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।
538
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).
व्याख्या (हिन्दी) यूनियन का आकार कम से कम उसके सबसे बड़े सदस्य के आकार (साथ ही संरेखण के लिए संभावित पैडिंग) के बराबर है।
539
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' लौटाता है। आउटपुट: मैं.
540
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 +,-,*,/ और एब्स, आर्ग, पोलर, रियल, इमेज जैसे कार्यों का समर्थन करता है।
526–540 of 1915