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
106
EN + हिं
GB What is the output: int x=255; cout<
IN आउटपुट क्या है: int x=255; अदालत
A
ff सीमांत बल
B
ff सीमांत बल
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 255=0xFF. setw(8) pads to 8. Output: ff.
व्याख्या (हिन्दी) 255=0xFF. सेटडब्ल्यू(8) पैड से 8. आउटपुट: एफएफ।
107
EN + हिं
GB What is 'std::flat_map' in C++23?
IN C++23 में 'std::flat_map' क्या है?
A
Sorted associative container stored in flat arrays (cache-friendly) समतल सरणियों में संग्रहित क्रमबद्ध सहयोगी कंटेनर (कैश-अनुकूल)
B
Same as std::map std::map के समान
C
Hash-based map हैश आधारित मानचित्र
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) flat_map uses two sorted vectors for keys/values; better cache performance than node-based map.
व्याख्या (हिन्दी) फ़्लैट_मैप कुंजियों/मानों के लिए दो क्रमबद्ध वैक्टर का उपयोग करता है; नोड-आधारित मानचित्र की तुलना में बेहतर कैश प्रदर्शन।
108
EN + हिं
GB What is the output: int x=5; cout<0)<<' '<<(x<0);
IN आउटपुट क्या है: int x=5; अदालत
A
true false सच्चा झूठ
B
1 0 1 0
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) boolalpha prints true/false. Output: true false.
व्याख्या (हिन्दी) बूलल्फा सही/गलत प्रिंट करता है। आउटपुट: सच्चा झूठ।
109
EN + हिं
GB What is 'std::generator' in C++23?
IN C++23 में 'std::जनरेटर' क्या है?
A
Coroutine-based range generator कोरआउटिन-आधारित रेंज जनरेटर
B
A random number generator एक यादृच्छिक संख्या जनरेटर
C
An iterator एक पुनरावर्तक
D
A view एक दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::generator is a coroutine type that yields values lazily via co_yield.
व्याख्या (हिन्दी) std::जनरेटर एक कोरआउटिन प्रकार है जो सह_यील्ड के माध्यम से आसानी से मान उत्पन्न करता है।
110
EN + हिं
GB What is the output: int x=42; cout<
IN आउटपुट क्या है: int x=42; अदालत
A
52 2a 42 52 2ए 42
B
42 42 42 42 42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 42 in octal=52, hex=2a, dec=42. Output: 52 2a 42.
व्याख्या (हिन्दी) 42 में अष्टक=52, हेक्स=2ए, दशमांश=42। आउटपुट: 52 2ए 42।
111
EN + हिं
GB What is 'ranges::to' in C++23?
IN C++23 में 'रेंज::टू' क्या है?
A
Converts a range to a container: views::filter(...)|ranges::to<vector>() किसी श्रेणी को कंटेनर में परिवर्तित करता है: view::filter(...)|ranges::to()
B
A cast एक निक्षेपण
C
A sort एक प्रकार
D
A view एक दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ranges::to materializes a lazy view into a concrete container.
व्याख्या (हिन्दी) रेंज::टू एक आलसी दृश्य को एक ठोस कंटेनर में बदल देता है।
112
EN + हिं
GB What is the output: int x=5; cout<
IN आउटपुट क्या है: int x=5; अदालत
A
+5 -5 +5 -5
B
5 -5 5 -5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) showpos shows + for positive. Output: +5 -5.
व्याख्या (हिन्दी) शोपोज़ सकारात्मक के लिए + दिखाता है। आउटपुट: +5 -5.
113
EN + हिं
GB What is 'std::move_only_function' vs std::function?
IN 'std::move_only_function' बनाम std::function क्या है?
A
move_only_function holds non-copyable callables move_only_function गैर-प्रतिलिपि योग्य कॉलेबल रखता है
B
Same thing एक ही बात
C
Slower और धीमा
D
C++17 only केवल सी++17
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::move_only_function (C++23) stores move-only callables unlike std::function which requires copyable.
व्याख्या (हिन्दी) std::move_only_function (C++23) std::function के विपरीत मूव-ओनली कॉलेबल्स को स्टोर करता है जिसके लिए कॉपी करने योग्य की आवश्यकता होती है।
114
EN + हिं
GB What is the output: cout<
IN आउटपुट क्या है: cout
A
00042 00042
B
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) setfill('0') pads with zeros. setw(5): 00042. Output: 00042.
व्याख्या (हिन्दी) शून्य के साथ सेटफिल('0') पैड। सेटव(5): 00042. आउटपुट: 00042.
115
EN + हिं
GB What is 'std::string_view::substr'?
IN 'std::string_view::substr' क्या है?
A
Returns a string_view of a sub-range (no allocation) उप-श्रेणी का एक स्ट्रिंग_व्यू लौटाता है (कोई आवंटन नहीं)
B
Returns a new string एक नई स्ट्रिंग लौटाता है
C
Modifies original मूल को संशोधित करता है
D
Throws always हमेशा फेंकता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) string_view::substr returns another non-owning view; no heap allocation.
व्याख्या (हिन्दी) string_view::substr एक अन्य गैर-स्वामित्व वाला दृश्य लौटाता है; कोई ढेर आवंटन नहीं.
116
EN + हिं
GB What is the output: string s="hello"; string_view sv=s; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; स्ट्रिंग_व्यू sv=s; अदालत
A
ell पक्ष
B
hel हेल
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Characters 1,2,3: e,l,l. Output: ell.
व्याख्या (हिन्दी) अक्षर 1,2,3: ई, एल, एल। आउटपुट: ell.
117
EN + हिं
GB What is 'std::chrono::hh_mm_ss'?
IN 'std::chrono::hh_mm_ss' क्या है?
A
Splits duration into hours, minutes, seconds (C++20) अवधि को घंटों, मिनटों, सेकंडों में विभाजित करता है (C++20)
B
A clock type एक घड़ी प्रकार
C
A time point एक समय बिंदु
D
A timer एक टाइमर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) hh_mm_ss decomposes a duration into components for display.
व्याख्या (हिन्दी) hh_mm_ss प्रदर्शन के लिए अवधि को घटकों में विघटित करता है।
118
EN + हिं
GB What is the output: int x=5; cout<<(x==5?'Y':'N')<<(x!=5?'Y':'N');
IN आउटपुट क्या है: int x=5; अदालत
A
YN YN
B
NY न्यूयॉर्क
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x==5: Y; x!=5: N. Output: YN.
व्याख्या (हिन्दी) एक्स==5: वाई; x!=5: एन. आउटपुट: YN.
119
EN + हिं
GB What is 'std::flat_set' in C++23?
IN C++23 में 'std::flat_set' क्या है?
A
Sorted unique set in flat sorted vector फ्लैट सॉर्ट किए गए वेक्टर में क्रमबद्ध अद्वितीय सेट
B
Same as std::set std::set के समान
C
Hash set हैश सेट
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) flat_set provides O(log n) lookup with better cache performance using sorted vector.
व्याख्या (हिन्दी) फ़्लैट_सेट सॉर्ट किए गए वेक्टर का उपयोग करके बेहतर कैश प्रदर्शन के साथ ओ (लॉग एन) लुकअप प्रदान करता है।
120
EN + हिं
GB What is the output: int x=10; cout<<(x%3==0?'D':x%3==1?'R':'M');
IN आउटपुट क्या है: int x=10; अदालत
A
R आर
B
D डी
C
M एम
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10%3=1: returns 'R'. Output: R.
व्याख्या (हिन्दी) 10%3=1: 'आर' लौटाता है। आउटपुट: आर.
106–120 of 187