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
1096
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 के विपरीत मूव-ओनली कॉलेबल्स को स्टोर करता है जिसके लिए कॉपी करने योग्य की आवश्यकता होती है।
1097
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.
1098
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 एक अन्य गैर-स्वामित्व वाला दृश्य लौटाता है; कोई ढेर आवंटन नहीं.
1099
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.
1100
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 प्रदर्शन के लिए अवधि को घटकों में विघटित करता है।
1101
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.
1102
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.
व्याख्या (हिन्दी) फ़्लैट_सेट सॉर्ट किए गए वेक्टर का उपयोग करके बेहतर कैश प्रदर्शन के साथ ओ (लॉग एन) लुकअप प्रदान करता है।
1103
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: 'आर' लौटाता है। आउटपुट: आर.
1104
EN + हिं
GB What is 'std::expected::and_then'?
IN 'std::expected::and_then' क्या है?
A
Chains operation on success value सफलता मूल्य पर चेन संचालन
B
Same as transform परिवर्तन के समान
C
Error handler त्रुटि संचालक
D
A monad bind एक सन्यासी बाइंड
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) exp.and_then(f) applies f if expected has value; propagates error otherwise. Monadic chaining.
व्याख्या (हिन्दी) यदि अपेक्षित का मान है तो exp.and_then(f) f लागू होता है; अन्यथा त्रुटि का प्रचार करता है। मोनाडिक श्रृखंला।
1105
EN + हिं
GB What is the output: int x=7; cout<<(x|x<<1|x<<2);
IN आउटपुट क्या है: int x=7; अदालत
A
31 31
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7=0111; 14=1110; 28=11100. OR=11111=31. Output: 31.
व्याख्या (हिन्दी) 7=0111; 14=1110; 28=11100. या=1111=31. आउटपुट: 31.
1106
EN + हिं
GB What is 'std::stacktrace' in C++23?
IN C++23 में 'std::stacktrace' क्या है?
A
Captures and prints current call stack at runtime रनटाइम पर वर्तमान कॉल स्टैक को कैप्चर और प्रिंट करता है
B
A debugger एक डिबगर
C
A profiler एक प्रोफाइलर
D
A logger एक लकड़हारा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::stacktrace::current() captures the call stack; useful for diagnostics.
व्याख्या (हिन्दी) std::stacktrace::current() कॉल स्टैक को कैप्चर करता है; निदान के लिए उपयोगी.
1107
EN + हिं
GB What is the output: auto x=1; auto y=2; cout<<(x<=>y<0);
IN आउटपुट क्या है: ऑटो x=1; ऑटो y=2; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<=>2 is negative (1<2). < 0 = true = 1. Output: 1.
व्याख्या (हिन्दी) 12 नकारात्मक है (1
1108
EN + हिं
GB What is 'std::inplace_vector' in C++26?
IN C++26 में 'std::inplace_vector' क्या है?
A
Fixed-capacity vector stored inline (no heap) निश्चित-क्षमता वेक्टर इनलाइन संग्रहीत (कोई ढेर नहीं)
B
A stack<T,N> एक ढेर
C
Same as array सरणी के समान
D
A span variant एक स्पैन वैरिएंट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) inplace_vector provides dynamic-size interface with static storage; avoids heap.
व्याख्या (हिन्दी) inplace_vector स्थिर भंडारण के साथ गतिशील आकार इंटरफ़ेस प्रदान करता है; ढेर से बचता है.
1109
EN + हिं
GB What is the output: int x=5; cout<<__builtin_clz(x);
IN आउटपुट क्या है: int x=5; अदालत
A
29 29
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5=00000000000000000000000000000101. Leading zeros=29. Output: 29.
व्याख्या (हिन्दी) 5=0000000000000000000000000101. अग्रणी शून्य=29. आउटपुट: 29.
1110
EN + हिं
GB What is 'std::ranges::zip' (C++23)?
IN 'std::ranges::zip' (C++23) क्या है?
A
Creates range of tuples from multiple ranges अनेक श्रेणियों से टुपल्स की श्रेणी बनाता है
B
Sorts ranges together एक साथ क्रमबद्ध होते हैं
C
Merges ranges श्रेणियाँ विलीन हो जाती हैं
D
Same as transform परिवर्तन के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::zip(r1,r2) yields pair of elements; stops at shortest range.
व्याख्या (हिन्दी) view::zip(r1,r2) तत्वों की जोड़ी उत्पन्न करता है; सबसे कम दूरी पर रुकता है.
1096–1110 of 1915