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
121
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 लागू होता है; अन्यथा त्रुटि का प्रचार करता है। मोनाडिक श्रृखंला।
122
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.
123
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() कॉल स्टैक को कैप्चर करता है; निदान के लिए उपयोगी.
124
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
125
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 स्थिर भंडारण के साथ गतिशील आकार इंटरफ़ेस प्रदान करता है; ढेर से बचता है.
126
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.
127
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) तत्वों की जोड़ी उत्पन्न करता है; सबसे कम दूरी पर रुकता है.
128
EN + हिं
GB What is the output: int x=5; auto f=[x]()mutable->int{return x++;}; cout<
IN आउटपुट क्या है: int x=5; ऑटो f=[x]()mutable->int{रिटर्न x++;}; अदालत
A
Unspecified order अनिर्दिष्ट आदेश
B
567 567
C
555 555
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Order of evaluation of cout arguments is unspecified.
व्याख्या (हिन्दी) कॉउट तर्कों के मूल्यांकन का क्रम अनिर्दिष्ट है।
129
EN + हिं
GB What is 'std::ranges::chunk' (C++23)?
IN 'std::ranges::chunk' (C++23) क्या है?
A
Splits range into fixed-size sub-ranges विभाजन निश्चित आकार की उप-श्रेणियों में होता है
B
Same as partition विभाजन के समान
C
A grouping view एक समूहीकरण दृश्य
D
A window view एक खिड़की का दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::chunk(r, n) produces sub-ranges of size n (last may be smaller).
व्याख्या (हिन्दी) view::chunk(r, n) आकार n की उप-श्रेणियाँ उत्पन्न करता है (अंतिम छोटा हो सकता है)।
130
EN + हिं
GB What is the output: int x=0b10101010; cout<<__builtin_popcount(x);
IN आउटपुट क्या है: int x=0b10101010; अदालत
A
4 4
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0xAA=10101010: four 1-bits. Output: 4.
व्याख्या (हिन्दी) 0xAA=10101010: चार 1-बिट। आउटपुट: 4.
131
EN + हिं
GB What is 'std::views::enumerate' (C++23)?
IN 'std::views::enumerate' (C++23) क्या है?
A
Provides (index, element) pairs from a range एक श्रेणी से (सूचकांक, तत्व) जोड़े प्रदान करता है
B
Same as zip with iota Iota के साथ ज़िप के समान
C
Adds index to elements तत्वों में सूचकांक जोड़ता है
D
Both A and B ए और बी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::enumerate yields (index,value) pairs; equivalent to zip(iota(0),range).
व्याख्या (हिन्दी) दृश्य:: पैदावार (सूचकांक, मूल्य) जोड़े की गणना करें; ज़िप(iota(0),रेंज) के बराबर।
132
EN + हिं
GB What is the output: int x=5; cout<<(x*(x+1)/2);
IN आउटपुट क्या है: int x=5; अदालत
A
15 15
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5*6/2=15. Output: 15.
व्याख्या (हिन्दी) 5*6/2=15. आउटपुट: 15.
133
EN + हिं
GB What is 'std::unreachable' in C++23?
IN C++23 में 'std::unreachable' क्या है?
A
Tells compiler a point is unreachable; UB if reached संकलक को बताता है कि एक बिंदु पहुंच योग्य नहीं है; अगर पहुंच गया तो यूबी
B
A compile error एक संकलन त्रुटि
C
A runtime exception एक रनटाइम अपवाद
D
A warning एक चेतावनी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::unreachable() enables dead-code elimination; if executed it is undefined behavior.
व्याख्या (हिन्दी) std::unreachable() डेड-कोड उन्मूलन को सक्षम बनाता है; यदि निष्पादित किया जाता है तो यह अपरिभाषित व्यवहार है।
134
EN + हिं
GB What is the output: int x=0xFF00; cout<<(x>>8);
IN आउटपुट क्या है: int x=0xFF00; cout8);
A
255 255
C
65280 65280
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0xFF00>>8=0x00FF=255. Output: 255.
व्याख्या (हिन्दी) 0xFF00>>8=0x00FF=255. आउटपुट: 255.
135
EN + हिं
GB What is 'std::ranges::slide' (C++23)?
IN 'std::ranges::slide' (C++23) क्या है?
A
Sliding window view of size N आकार N का स्लाइडिंग विंडो दृश्य
B
Same as chunk टुकड़े के समान
C
A rotate view एक घूमता हुआ दृश्य
D
A filter view एक फ़िल्टर दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::slide(r,n) yields overlapping sub-ranges of size n (sliding window).
व्याख्या (हिन्दी) दृश्य::स्लाइड(आर,एन) आकार एन (स्लाइडिंग विंडो) की ओवरलैपिंग उप-श्रेणियां उत्पन्न करता है।
121–135 of 187