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
1141
EN + हिं
GB What is the output: int x=5; auto y=static_cast(x)/2; cout<
IN आउटपुट क्या है: int x=5; ऑटो y=static_cast(x)/2; अदालत
A
2.5 2.5
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5.0/2=2.5. Output: 2.5.
व्याख्या (हिन्दी) 5.0/2=2.5. आउटपुट: 2.5.
1142
EN + हिं
GB What is 'std::type_identity'?
IN 'std::type_identity' क्या है?
A
Identity type trait: type_identity<T>::type = T पहचान प्रकार विशेषता: type_identity::type = T
B
Removes const स्थिरांक हटाता है
C
Adds reference संदर्भ जोड़ता है
D
Decays type क्षय प्रकार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) type_identity prevents deduction: f(type_identity_t) requires explicit T.
व्याख्या (हिन्दी) type_identity कटौती को रोकता है: f(type_identity_t) को स्पष्ट T की आवश्यकता होती है।
1143
EN + हिं
GB What is the output: int x=1000000; long long y=x*x; cout<
IN आउटपुट क्या है: int x=1000000; लंबा लंबा y=x*x; अदालत
A
1000000000000 100000000000
B
Undefined behavior अपरिभाषित व्यवहार
C
1000000 1000000
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x*x computed as int: 1e6*1e6=1e12 overflows int. UB before assignment to long long.
व्याख्या (हिन्दी) x*x की गणना int के रूप में की जाती है: 1e6*1e6=1e12 int ओवरफ्लो करता है। लंबे समय तक असाइनमेंट से पहले यूबी।
1144
EN + हिं
GB What is the output: string s="abc"; s.reserve(100); cout<
IN आउटपुट क्या है: स्ट्रिंग s='abc'; एस.रिजर्व(100); अदालत
A
3 100 3 100
B
100 100 100 100
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=3; capacity>=100. Output: 3 100.
व्याख्या (हिन्दी) आकार=3; क्षमता>=100. आउटपुट: 3 100.
1145
EN + हिं
GB What is 'std::to_chars' vs 'std::to_string'?
IN 'std::to_chars' बनाम 'std::to_string' क्या है?
A
to_chars: no allocation, faster; to_string: allocates string to_chars: कोई आवंटन नहीं, तेज़; to_string: स्ट्रिंग आवंटित करता है
B
Same performance वही प्रदर्शन
C
to_string is faster to_string तेज़ है
D
to_chars throws to_chars फेंकता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::to_chars writes to a char buffer without allocation; to_string returns a new string.
व्याख्या (हिन्दी) std::to_chars आवंटन के बिना एक चार बफर को लिखता है; to_string एक नई स्ट्रिंग लौटाता है।
1146
EN + हिं
GB What is the output: char buf[10]; auto [ptr,ec]=to_chars(buf,buf+10,42); *ptr=0; cout<
IN आउटपुट क्या है: char buf[10]; ऑटो [ptr,ec]=to_chars(buf,buf+10,42); *पीटीआर=0; अदालत
A
42 42
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) to_chars writes '4','2'; null-terminate; cout<
व्याख्या (हिन्दी) to_chars '4','2' लिखता है; शून्य-समाप्त; अदालत
1147
EN + हिं
GB What is 'std::from_chars'?
IN 'std::from_chars' क्या है?
A
Parses number from char buffer without locale/allocation स्थान/आवंटन के बिना चार बफ़र से संख्या पार्स करता है
B
Same as stoi स्टोइ के समान
C
Throws on error त्रुटि पर फेंकता है
D
Returns string स्ट्रिंग लौटाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) from_chars(&buf[0],&buf[n],x) parses integer/float efficiently.
व्याख्या (हिन्दी) from_chars(&buf[0],&buf[n],x) कुशलतापूर्वक पूर्णांक/फ्लोट को पार्स करता है।
1148
EN + हिं
GB What is the output: int x; from_chars("123","123"+3,x); cout<
IN आउटपुट क्या है: int x; from_chars("123","123"+3,x); अदालत
A
123 123
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Parses 123 into x. Output: 123.
व्याख्या (हिन्दी) पार्स 123 x में। आउटपुट: 123.
1149
EN + हिं
GB What is 'std::remove_cvref_t'?
IN 'std::remove_cvref_t' क्या है?
A
Removes const, volatile, and reference from type प्रकार से स्थिरांक, अस्थिर और संदर्भ हटाता है
B
Removes pointer सूचक हटाता है
C
Adds const स्थिरांक जोड़ता है
D
Same as decay क्षय के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) remove_cvref_t = int.
व्याख्या (हिन्दी) हटाएं_cvref_t = int.
1150
EN + हिं
GB What is the output: cout<,int>;
IN आउटपुट क्या है: cout
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Removes const and &. Result=int. is_same=1. Output: 1.
व्याख्या (हिन्दी) स्थिरांक और & को हटाता है। परिणाम=अंत. समान=1 है. आउटपुट: 1.
1151
EN + हिं
GB What is 'std::type_traits is_trivially_destructible'?
IN 'std::type_traits is_trivially_destructible' क्या है?
A
True if destructor is trivial (no user-defined dtor) सत्य है यदि विध्वंसक तुच्छ है (कोई उपयोगकर्ता-परिभाषित dtor नहीं)
B
True for all types सभी प्रकार के लिए सच है
C
False for POD पीओडी के लिए गलत
D
Compile-time check संकलन-समय की जाँच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) is_trivially_destructible::value=true; class with user dtor=false.
व्याख्या (हिन्दी) is_trivially_destructible::value=true; उपयोगकर्ता के साथ वर्ग dtor=झूठा।
1152
EN + हिं
GB What is the output: cout<<;
IN आउटपुट क्या है: cout
A
10 10
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int: true=1; string has dtor: false=0. Output: 10.
व्याख्या (हिन्दी) int: सत्य=1; स्ट्रिंग में dtor: false=0 है। आउटपुट: 10.
1153
EN + हिं
GB What is 'std::common_type'?
IN 'std::common_type' क्या है?
A
Deduces common type of multiple types कई प्रकार के सामान्य प्रकार का अनुमान लगाता है
B
Smallest type सबसे छोटा प्रकार
C
Largest type सबसे बड़ा प्रकार
D
Most general type सबसे सामान्य प्रकार
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) common_type::type = double (arithmetic conversion).
व्याख्या (हिन्दी) सामान्य_प्रकार::प्रकार = दोहरा (अंकगणितीय रूपांतरण)।
1154
EN + हिं
GB What is the output: cout<,double>;
IN आउटपुट क्या है: cout
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int+double promotes to double. is_same=1. Output: 1.
व्याख्या (हिन्दी) int+double दोगुना करने को बढ़ावा देता है। समान=1 है. आउटपुट: 1.
1155
EN + हिं
GB What is 'std::is_aggregate'?
IN 'std::is_aggregate' क्या है?
A
True if type is aggregate (no user-provided ctor, no private/protected) यदि प्रकार समग्र है तो सही है (कोई उपयोगकर्ता द्वारा प्रदत्त सीटीओआर नहीं, कोई निजी/संरक्षित नहीं)
B
True for all structs सभी संरचनाओं के लिए सच है
C
False for arrays सरणियों के लिए गलत
D
Runtime check रनटाइम जांच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) is_aggregate is a compile-time check using type traits.
व्याख्या (हिन्दी) is_aggregate प्रकार के लक्षणों का उपयोग करके एक संकलन-समय जांच है।
1141–1155 of 1915