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
1111
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.
व्याख्या (हिन्दी) कॉउट तर्कों के मूल्यांकन का क्रम अनिर्दिष्ट है।
1112
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 की उप-श्रेणियाँ उत्पन्न करता है (अंतिम छोटा हो सकता है)।
1113
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.
1114
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),रेंज) के बराबर।
1115
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.
1116
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() डेड-कोड उन्मूलन को सक्षम बनाता है; यदि निष्पादित किया जाता है तो यह अपरिभाषित व्यवहार है।
1117
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.
1118
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).
व्याख्या (हिन्दी) दृश्य::स्लाइड(आर,एन) आकार एन (स्लाइडिंग विंडो) की ओवरलैपिंग उप-श्रेणियां उत्पन्न करता है।
1119
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.
1120
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 के विपरीत गहराई से प्रतिलिपियाँ।
1121
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.
1122
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 बार दोहराता है।
1123
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
1124
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 में जुड़ जाता है।
1125
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.
1111–1125 of 1915