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
91
EN + हिं
GB What is 'std::stop_token' in C++20?
IN C++20 में 'std::stop_token' क्या है?
A
Mechanism for cooperative thread cancellation सहकारी धागा रद्दीकरण के लिए तंत्र
B
A mutex एक म्यूटेक्स
C
An atomic flag एक परमाणु ध्वज
D
A future एक भविष्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::stop_token allows threads to check if cancellation was requested; used with std::jthread.
व्याख्या (हिन्दी) std::stop_token थ्रेड्स को यह जांचने की अनुमति देता है कि क्या रद्दीकरण का अनुरोध किया गया था; std::jthread के साथ प्रयोग किया जाता है।
92
EN + हिं
GB What is the output: constexpr int f(int n){return n<=1?1:n*f(n-1);} cout<
IN आउटपुट क्या है: constexpr int f(int n){return n
A
720 720
B
120 120
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6!=720. Output: 720.
व्याख्या (हिन्दी) 6!=720. आउटपुट: 720.
93
EN + हिं
GB What is 'std::coroutine_handle'?
IN 'std::coroutine_handle' क्या है?
A
Low-level handle to resume/destroy a suspended coroutine निलंबित कोरआउटिन को फिर से शुरू/नष्ट करने के लिए निम्न-स्तरीय हैंडल
B
A thread handle एक धागे का हैंडल
C
A future handle एक भविष्य का हैंडल
D
A fiber handle एक फाइबर हैंडल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::coroutine_handle

wraps a coroutine frame pointer; .resume() continues execution from suspension point.

व्याख्या (हिन्दी) std::coroutine_handle एक coroutine फ़्रेम पॉइंटर को लपेटता है; .resume() निलंबन बिंदु से निष्पादन जारी रखता है।
94
EN + हिं
GB What is the output: int x=5; cout<<(x*x-1)%(x+1);
IN आउटपुट क्या है: int x=5; अदालत
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (25-1)%(6)=24%6=0.
व्याख्या (हिन्दी) (25-1)%(6)=24%6=0.
95
EN + हिं
GB What is the output: int x=5; cout<<(x+(x=10));
IN आउटपुट क्या है: int x=5; अदालत
A
Undefined behavior अपरिभाषित व्यवहार
B
15 15
C
20 20
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reading x and assigning x in same expression without sequencing is UB.
व्याख्या (हिन्दी) x को पढ़ना और अनुक्रमण के बिना एक ही अभिव्यक्ति में x निर्दिष्ट करना UB है।
96
EN + हिं
GB What is 'std::execution::par' policy?
IN 'std::execution::par' नीति क्या है?
A
Parallel algorithm execution policy (C++17) समानांतर एल्गोरिथम निष्पादन नीति (C++17)
B
Sequential execution अनुक्रमिक निष्पादन
C
GPU execution जीपीयू निष्पादन
D
Thread pool only केवल थ्रेड पूल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::sort(std::execution::par, ...) uses parallel execution if supported.
व्याख्या (हिन्दी) std::sort(std::execution::par, ...) यदि समर्थित हो तो समानांतर निष्पादन का उपयोग करता है।
97
EN + हिं
GB What is the output: cout<::min()+numeric_limits::max();
IN आउटपुट क्या है: cout
A
-1 -1
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INT_MIN+INT_MAX = -2147483648+2147483647 = -1. Output: -1.
व्याख्या (हिन्दी) INT_MIN+INT_MAX = -2147483648+2147483647 = -1. आउटपुट:-1.
98
EN + हिं
GB What is the output: auto x=0xDEAD; cout<
IN आउटपुट क्या है: auto x=0xDEAD; अदालत
A
dead मृत
B
DEAD मृत
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) hex stream manipulator outputs lowercase. Output: dead.
व्याख्या (हिन्दी) हेक्स स्ट्रीम मैनिपुलेटर लोअरकेस आउटपुट देता है। आउटपुट: मृत.
99
EN + हिं
GB What is 'std::jthread' stop_source?
IN 'std::jthread' stop_source क्या है?
A
Provides stop_token to request cooperative cancellation सहकारी रद्दीकरण का अनुरोध करने के लिए stop_token प्रदान करता है
B
Kills thread forcefully धागे को जबरदस्ती मारता है
C
Pauses thread थ्रेड को रोकता है
D
Same as mutex म्यूटेक्स के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) stop_source::request_stop() signals stop_token; thread checks token.stop_requested().
व्याख्या (हिन्दी) stop_source::request_stop() सिग्नल stop_token; थ्रेड टोकन.stop_requested() की जाँच करता है।
100
EN + हिं
GB What is the output: int x=5; cout<<(x&(~0<<2));
IN आउटपुट क्या है: int x=5; अदालत
A
4 4
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ~0<<2 = ...11111100. 5=101. 101&...100 = 100 = 4. Output: 4.
व्याख्या (हिन्दी) ~0
101
EN + हिं
GB What is 'deducing this' (C++23)?
IN 'इसे घटाना' (C++23) क्या है?
A
Explicit this parameter: void f(this auto& self){} इस पैरामीटर को स्पष्ट करें: void f(this auto& self){}
B
New keyword नया कीवर्ड
C
CRTP replacement सीआरटीपी प्रतिस्थापन
D
Both B and C बी और सी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++23 deducing this allows explicit self parameter, enabling simpler CRTP and recursive lambdas.
व्याख्या (हिन्दी) C++23 इसका निष्कर्षण स्पष्ट स्व-पैरामीटर की अनुमति देता है, जिससे सरल सीआरटीपी और पुनरावर्ती लैम्ब्डा सक्षम होता है।
102
EN + हिं
GB What is the output: int x=0b11110000; cout<<(x>>4&0xF);
IN आउटपुट क्या है: int x=0b11110000; cout4&0xF);
A
15 15
C
240 240
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0xF0>>4=0x0F=15. 15&15=15. Output: 15.
व्याख्या (हिन्दी) 0xF0>>4=0x0F=15. 15&15=15. आउटपुट: 15.
103
EN + हिं
GB What is 'std::mdspan'?
IN 'std::mdspan' क्या है?
A
Non-owning multidimensional array view (C++23) गैर-स्वामित्व वाला बहुआयामी सरणी दृश्य (C++23)
B
A matrix class एक मैट्रिक्स वर्ग
C
3D vector 3डी वेक्टर
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) mdspan provides multidimensional indexing over contiguous data without owning it.
व्याख्या (हिन्दी) mdspan सन्निहित डेटा पर स्वामित्व के बिना बहुआयामी अनुक्रमण प्रदान करता है।
104
EN + हिं
GB What is the output: constexpr int f(int n){return n<=1?1:n*f(n-1);} static_assert(f(5)==120); cout<<'Y';
IN आउटपुट क्या है: constexpr int f(int n){return n
A
Y वाई
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=120; static_assert passes; prints Y. Output: Y.
व्याख्या (हिन्दी) f(5)=120; static_assert पास; Y प्रिंट करता है। आउटपुट: Y।
105
EN + हिं
GB What is 'std::print' in C++23?
IN C++23 में 'std::print' क्या है?
A
Type-safe formatted output (like Python print) टाइप-सुरक्षित स्वरूपित आउटपुट (पायथन प्रिंट की तरह)
B
Same as printf प्रिंटफ के समान
C
Deprecated cout पदावनत कोउट
D
A debug tool एक डिबग टूल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::print("{}", 42) outputs formatted text; std::println adds newline.
व्याख्या (हिन्दी) std::print("{}", 42) स्वरूपित पाठ को आउटपुट करता है; std::println नई लाइन जोड़ता है।
91–105 of 187