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
106
EN + हिं
GB What is 'std::underlying_type'?
IN 'std::underlying_type' क्या है?
A
Gets underlying integer type of enum अंतर्निहित पूर्णांक प्रकार का एनम प्राप्त करता है
B
Makes enum an int एनम को इंट बनाता है
C
A cast एक निक्षेपण
D
Runtime check रनटाइम जांच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) enum E:short{A}; underlying_type::type = short.
व्याख्या (हिन्दी) एनम ई: लघु {ए}; अंतर्निहित_प्रकार::प्रकार = संक्षिप्त।
107
EN + हिं
GB What is the output: enum class E:uint8_t{A,B,C}; cout<);
IN आउटपुट क्या है: enum class E:uint8_t{A,B,C}; अदालत
A
1 1
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) uint8_t is 1 byte. Output: 1.
व्याख्या (हिन्दी) uint8_t 1 बाइट है. आउटपुट: 1.
108
EN + हिं
GB What is 'std::aligned_storage'?
IN 'std::aligned_storage' क्या है?
A
Aligned raw storage for placement new नए प्लेसमेंट के लिए संरेखित कच्चा भंडारण
B
A smart pointer एक स्मार्ट सूचक
C
A buffer type एक बफ़र प्रकार
D
Both B and C बी और सी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) aligned_storage::type provides properly aligned storage for T.
व्याख्या (हिन्दी) संरेखित_स्टोरेज::प्रकार टी के लिए उचित रूप से संरेखित भंडारण प्रदान करता है।
109
EN + हिं
GB What is 'std::is_layout_compatible'?
IN 'std::is_layout_compatible' क्या है?
A
True if two types have same memory layout (C++20) यह सत्य है यदि दो प्रकारों में समान मेमोरी लेआउट है (C++20)
B
Same as is_same जैसा है वैसा ही है
C
ABI check एबीआई जांच
D
Runtime check रनटाइम जांच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) is_layout_compatible enables safe type punning via memcpy.
व्याख्या (हिन्दी) is_layout_compatible memcpy के माध्यम से सुरक्षित प्रकार की पनिंग को सक्षम बनाता है।
110
EN + हिं
GB What is the output: int x=5; auto p=reinterpret_cast(&x); cout<<(int)*p;
IN आउटपुट क्या है: int x=5; ऑटो पी=पुनर्व्याख्या_कास्ट(&x); अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Little-endian: first byte = lowest byte of 5 = 5 (since 5 < 256). Output: 5.
व्याख्या (हिन्दी) लिटिल-एंडियन: पहला बाइट = 5 का सबसे निचला बाइट = 5 (चूंकि 5 <256)। आउटपुट: 5.
111
EN + हिं
GB What is 'std::is_standard_layout'?
IN 'std::is_standard_layout' क्या है?
A
Type compatible with C struct layout सी संरचना लेआउट के साथ संगत टाइप करें
B
Same as POD पीओडी के समान
C
Has virtual आभासी है
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Standard layout types can be safely passed to C functions and accessed via memcpy.
व्याख्या (हिन्दी) मानक लेआउट प्रकारों को C फ़ंक्शंस में सुरक्षित रूप से पास किया जा सकता है और memcpy के माध्यम से एक्सेस किया जा सकता है।
112
EN + हिं
GB What is the output: struct A{int x; double y;}; cout<;
IN आउटपुट क्या है: struct A{int x; डबल वाई;}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) No virtual, no mixed access specifiers. Standard layout = 1. Output: 1.
व्याख्या (हिन्दी) कोई वर्चुअल, कोई मिश्रित एक्सेस विनिर्देशक नहीं। मानक लेआउट = 1. आउटपुट: 1.
113
EN + हिं
GB What is 'std::has_unique_object_representations'?
IN 'std::has_unique_object_repretations' क्या है?
A
True if type has unique bit pattern per value (no padding bits) यह सत्य है यदि प्रकार में प्रति मान अद्वितीय बिट पैटर्न है (कोई पैडिंग बिट नहीं)
B
Always true for int इंट के लिए हमेशा सच है
C
Float check फ़्लोट चेक
D
Runtime check रनटाइम जांच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) True for char, int (usually); false for float (NaN), structs with padding.
व्याख्या (हिन्दी) चार, इंट (आमतौर पर) के लिए सच है; फ्लोट (NaN) के लिए गलत, पैडिंग के साथ संरचनाएं।
114
EN + हिं
GB What is the output: cout<<;
IN आउटपुट क्या है: cout
A
10 10
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int=1 (usually); float=0 (NaN has multiple representations). Output: 10.
व्याख्या (हिन्दी) int=1 (आमतौर पर); फ्लोट=0 (NaN में एकाधिक प्रतिनिधित्व हैं)। आउटपुट: 10.
115
EN + हिं
GB What is 'std::integer_sequence' usage pattern?
IN 'std::integer_sequence' उपयोग पैटर्न क्या है?
A
index_sequence used to unpack tuples in templates Index_sequence का उपयोग टेम्प्लेट में टुपल्स को अनपैक करने के लिए किया जाता है
B
Runtime index रनटाइम इंडेक्स
C
Loop replacement लूप प्रतिस्थापन
D
A container कंटेनर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_index_sequence generates 0,1,...,N-1 for use with std::get(tuple).
व्याख्या (हिन्दी) make_index_sequence std::get(tuple) के साथ उपयोग के लिए 0,1,...,N-1 उत्पन्न करता है।
116
EN + हिं
GB What is the output: using IS=index_sequence<0,1,2>; cout<
IN आउटपुट क्या है: IS=index_sequence का उपयोग करना; अदालत
A
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) IS has 3 elements. size()=3. Output: 3.
व्याख्या (हिन्दी) आईएस के तीन तत्व हैं. आकार()=3. आउटपुट: 3.
117
EN + हिं
GB What is 'std::bool_constant'?
IN 'std::bool_constant' क्या है?
A
Alias for integral_constant<bool,B> इंटीग्रल_कॉन्स्टेंट के लिए उपनाम
B
A bool wrapper एक बूल रैपर
C
Same as bool बूल के समान
D
Compile-time bool संकलन-समय बूल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) true_type=bool_constant; false_type=bool_constant.
व्याख्या (हिन्दी) true_type=bool_constant; false_type=bool_constant.
118
EN + हिं
GB What is the output: cout<,true_type>;
IN आउटपुट क्या है: cout
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) true_type is bool_constant. is_same=1. Output: 1.
व्याख्या (हिन्दी) true_type bool_constant है। समान=1 है. आउटपुट: 1.
119
EN + हिं
GB What is 'std::conjunction' and 'std::disjunction'?
IN 'std::conjunction' और 'std::disjunction' क्या है?
A
Short-circuit logical AND/OR on type traits शॉर्ट-सर्किट तार्किक और/या प्रकार के लक्षणों पर
B
Same as &&/|| &&/|| के समान
C
Runtime operations रनटाइम संचालन
D
Concept equivalents संकल्पना समकक्ष
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) conjunction is A::value && B::value && C::value evaluated lazily.
व्याख्या (हिन्दी) संयोजन A::value && B::value && C::value का मूल्यांकन आलस्यपूर्वक किया गया है।
120
EN + हिं
GB What is the output: cout<<;
IN आउटपुट क्या है: cout
A
01 01
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) conjunction=T&&T&&F=0; disjunction=F||T=1. Output: 01.
व्याख्या (हिन्दी) संयोजन=T&&T&&F=0; विच्छेदन=F||T=1. आउटपुट: 01.
106–120 of 160