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
136
EN + हिं
GB What is the output: int x=42; cout<(x);
IN आउटपुट क्या है: int x=42; अदालत
A
00101010 00101010
B
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 42=00101010 in binary. Output: 00101010.
व्याख्या (हिन्दी) 42=00101010 बाइनरी में। आउटपुट: 00101010.
137
EN + हिं
GB What is 'std::indirect' in C++26?
IN C++26 में 'std::indirect' क्या है?
A
Value-semantics smart pointer with deep copy डीप कॉपी के साथ वैल्यू-सिमेंटिक्स स्मार्ट पॉइंटर
B
Same as unique_ptr यूनिक_पीटीआर के समान
C
An optional एक वैकल्पिक
D
A reference wrapper एक संदर्भ आवरण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::indirect provides value semantics with heap storage; copies deeply unlike shared_ptr.
व्याख्या (हिन्दी) std::indirect ढेर भंडारण के साथ मूल्य शब्दार्थ प्रदान करता है; Shared_ptr के विपरीत गहराई से प्रतिलिपियाँ।
138
EN + हिं
GB What is the output: int x=5,y=3; cout<
IN आउटपुट क्या है: int x=5,y=3; अदालत
A
1 15 1 15
B
5 3 5 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) gcd(5,3)=1; lcm(5,3)=15. Output: 1 15.
व्याख्या (हिन्दी) जीसीडी(5,3)=1; एलसीएम(5,3)=15. आउटपुट: 1 15.
139
EN + हिं
GB What is 'std::views::repeat' (C++23)?
IN 'std::views::repeat' (C++23) क्या है?
A
Creates infinite or bounded range of repeated value दोहराए गए मान की अनंत या बंधी हुई सीमा बनाता है
B
Same as fill भरने के समान
C
A cycle view एक चक्र दृश्य
D
A generate view एक उत्पन्न दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::repeat(v) is infinite; views::repeat(v,n) repeats v exactly n times.
व्याख्या (हिन्दी) व्यूज::रिपीट(v) अनंत है; व्यूज::रिपीट(v,n) v को बिल्कुल n बार दोहराता है।
140
EN + हिं
GB What is the output: cout<<(1ull<<63);
IN आउटपुट क्या है: cout
A
9223372036854775808 9223372036854775808
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1ULL<<63 = 2^63 = 9223372036854775808. Output: 9223372036854775808.
व्याख्या (हिन्दी) 1ULL
141
EN + हिं
GB What is 'std::format_to' vs 'std::format'?
IN 'std::format_to' बनाम 'std::format' क्या है?
A
format_to writes to output iterator; format returns string form_to आउटपुट इटरेटर को लिखता है; प्रारूप रिटर्न स्ट्रिंग
B
Same thing एक ही बात
C
format_to is faster form_to तेज़ है
D
format deprecated प्रारूप बहिष्कृत
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::format_to(back_inserter(s), "{}", 42) appends to s without creating temporary string.
व्याख्या (हिन्दी) std::format_to(back_inserter(s), "{}", 42) अस्थायी स्ट्रिंग बनाए बिना s में जुड़ जाता है।
142
EN + हिं
GB What is the output: string s; format_to(back_inserter(s),"{:05d}",42); cout<
IN आउटपुट क्या है: स्ट्रिंग एस; format_to(back_inserter(s),"{:05d}",42); अदालत
A
00042 00042
B
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Format spec :05d: zero-pad to 5 digits. Output: 00042.
व्याख्या (हिन्दी) प्रारूप विशिष्टता: 05डी: शून्य-पैड से 5 अंक। आउटपुट: 00042.
143
EN + हिं
GB What is 'std::views::cartesian_product' (C++23)?
IN 'std::views::cartesian_product' (C++23) क्या है?
A
Yields all combinations from multiple ranges कई श्रेणियों से सभी संयोजन प्राप्त होते हैं
B
A zip view एक ज़िप दृश्य
C
A join view एक सम्मिलित दृश्य
D
A merge view एक मर्ज दृश्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::cartesian_product(r1,r2) yields (a,b) for all a in r1, b in r2.
व्याख्या (हिन्दी) view::cartesian_product(r1,r2) r1 में सभी a, r2 में b के लिए (a,b) उत्पन्न करता है।
144
EN + हिं
GB What is the output: auto v=vector{1,2,3,4,5}; auto r=v|views::filter([](int x){return x%2==0;})|views::transform([](int x){return x*x;}); for(int x:r) cout<
IN आउटपुट क्या है: ऑटो v=वेक्टर{1,2,3,4,5}; ऑटो r=v|व्यूज़::फ़िल्टर([](int x){रिटर्न x%2==0;})|व्यूज़::ट्रांसफ़ॉर्म([](int x){रिटर्न x*x;}); for(int x:r) कोउट
A
4 16 4 16
B
1 4 9 16 25 1 4 9 16 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Evens: 2,4. Squares: 4,16. Output: 4 16.
व्याख्या (हिन्दी) शाम: 2,4. वर्ग: 4,16. आउटपुट: 4 16.
145
EN + हिं
GB What is 'std::views::join_with' (C++23)?
IN 'std::views::join_with' (C++23) क्या है?
A
Joins range of ranges with delimiter सीमांकक के साथ श्रेणियों की श्रेणी को जोड़ता है
B
Same as join सम्मिलित होने के समान
C
A string join एक तार जुड़ता है
D
A flatten एक चपटा
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::join_with(ranges_of_ranges, delim) concatenates with delimiter between groups.
व्याख्या (हिन्दी) view::join_with(ranges_of_ranges, delim) समूहों के बीच सीमांकक के साथ जुड़ता है।
146
EN + हिं
GB What is the output: consteval int sq(int x){return x*x;} cout<
IN आउटपुट क्या है: consteval int sq(int x){return x*x;} cout
A
49 49
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) consteval forces compile-time. sq(7)=49. Output: 49.
व्याख्या (हिन्दी) कॉन्स्टवल बल संकलन-समय। वर्ग(7)=49. आउटपुट: 49.
147
EN + हिं
GB What is 'std::generator' usage?
IN 'std::जनरेटर' का उपयोग क्या है?
A
co_yield values lazily in a coroutine function कोरआउटिन फ़ंक्शन में सह-उपज मान आलसी हैं
B
A thread generator एक थ्रेड जनरेटर
C
Random generator यादृच्छिक जनरेटर
D
A factory एक कारखाना
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) generator g=[]()-> generator{ for(int i=0;;i++) co_yield i; }();
व्याख्या (हिन्दी) जनरेटर g=[]()-> जनरेटर{ for(int i=0;;i++) co_yield i; }();
148
EN + हिं
GB What is the output: int x=0; for(auto i:{1,2,3,4,5}) x+=i; cout<
IN आउटपुट क्या है: int x=0; for(ऑटो i:{1,2,3,4,5}) x+=i; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15.
149
EN + हिं
GB What is 'std::move_sentinel' in C++20?
IN C++20 में 'std::move_sentinel' क्या है?
A
Sentinel adapter that allows move-only sentinel types सेंटिनल एडॉप्टर जो केवल-स्थानांतरित सेंटिनल प्रकारों की अनुमति देता है
B
Same as sentinel प्रहरी के समान
C
An end iterator एक अंतिम पुनरावर्तक
D
A predicate sentinel एक विधेय प्रहरी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) move_sentinel wraps a sentinel so it can be used with move_iterator.
व्याख्या (हिन्दी) move_sentinel एक प्रहरी को लपेटता है ताकि इसका उपयोग move_iterator के साथ किया जा सके।
150
EN + हिं
GB What is the output: int x=5; string s=format("{:b}",x); cout<
IN आउटपुट क्या है: int x=5; स्ट्रिंग s=format("{:b}",x); अदालत
A
101 101
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) :b format spec outputs binary representation. 5=101. Output: 101.
व्याख्या (हिन्दी) :बी प्रारूप स्पेक बाइनरी प्रतिनिधित्व आउटपुट करता है। 5=101. आउटपुट: 101.
136–150 of 187