OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 160 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
160 questions
61
EN + हिं
GB What is the output: unsigned x=10; int y=-1; cout<<(x+y);
IN आउटपुट क्या है: unsigned x=10; int y=-1; अदालत
A
9 9
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
D
UINT_MAX+9 UINT_MAX+9
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) y=-1 converted to unsigned=UINT_MAX. 10+UINT_MAX wraps: UINT_MAX+11... wait: 10+(UINT_MAX)=UINT_MAX+10 which wraps to 9 (since UINT_MAX+1=0, UINT_MAX+10=9). Output: 9.
व्याख्या (हिन्दी) y=-1 को अहस्ताक्षरित=UINT_MAX में परिवर्तित किया गया। 10+UINT_MAX रैप्स: UINT_MAX+11... प्रतीक्षा करें: 10+(UINT_MAX)=UINT_MAX+10 जो 9 तक रैप होता है (चूंकि UINT_MAX+1=0, UINT_MAX+10=9)। आउटपुट: 9.
62
EN + हिं
GB What is 'std::byte to integer' conversion?
IN 'std::बाइट से पूर्णांक' रूपांतरण क्या है?
A
std::to_integer<int>(b) — explicit conversion std::to_integer(b) - स्पष्ट रूपांतरण
B
Implicit cast निहित कास्ट
C
reinterpret_cast पुनर्व्याख्या_कास्ट
D
C-style cast सी-स्टाइल कास्ट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::to_integer(b) explicitly converts std::byte to integer type.
व्याख्या (हिन्दी) std::to_integer(b) स्पष्ट रूप से std::byte को पूर्णांक प्रकार में परिवर्तित करता है।
63
EN + हिं
GB What is the output: char c='a'; c-=32; cout<
IN आउटपुट क्या है: char c='a'; सी-=32; अदालत
A
A
B
a
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'a'=97-32=65='A'. Output: A.
व्याख्या (हिन्दी) 'ए'=97-32=65='ए'। आउटपुट: ए.
64
EN + हिं
GB What is 'std::variant::index()'?
IN 'std::variant::index()' क्या है?
A
Returns index of currently held type वर्तमान में रखे गए प्रकार का सूचकांक लौटाता है
B
Returns value मान लौटाता है
C
Returns type name प्रकार का नाम लौटाता है
D
Returns size आकार लौटाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) variant v=3.14; v.index() returns 2 (double is 3rd type, 0-indexed).
व्याख्या (हिन्दी) वैरिएंट v=3.14; v.index() रिटर्न 2 (डबल तीसरा प्रकार है, 0-अनुक्रमित)।
65
EN + हिं
GB What is the output: int a=5,b=3; cout<
IN आउटपुट क्या है: int a=5,b=3; अदालत
A
15 15
B
8 8
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max of initializer_list: max is 15=a*b. Output: 15.
व्याख्या (हिन्दी) इनिशियलाइज़र_लिस्ट की अधिकतम सीमा: अधिकतम 15=a*b है। आउटपुट: 15.
66
EN + हिं
GB What is 'scoped enum' (enum class)?
IN 'स्कोप्ड एनम' (एनम क्लास) क्या है?
A
Enum values scoped to enum name; no implicit int conversion Enum मानों का दायरा enum नाम तक सीमित है; कोई अंतर्निहित अंतर रूपांतरण नहीं
B
Same as regular enum नियमित एनम के समान
C
A class with enum members एनम सदस्यों वाला एक वर्ग
D
Template enum टेम्प्लेट एनम
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) enum class Color{Red,Green}; requires Color::Red; no implicit conversion to int.
व्याख्या (हिन्दी) एनम वर्ग रंग {लाल, हरा}; रंग की आवश्यकता है::लाल; int में कोई अंतर्निहित रूपांतरण नहीं।
67
EN + हिं
GB What is the output: enum class E{A=1,B=2,C=4}; cout<<(int)E::C;
IN आउटपुट क्या है: enum class E{A=1,B=2,C=4}; अदालत
A
4 4
B
2 2
C
3 3
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) E::C=4; (int)E::C=4. Output: 4.
व्याख्या (हिन्दी) ई::सी=4; (int)E::C=4. आउटपुट: 4.
68
EN + हिं
GB What is 'std::any::type()'?
IN 'std::any::type()' क्या है?
A
Returns type_info of stored value संग्रहित मूल्य का type_info लौटाता है
B
Returns size आकार लौटाता है
C
Returns string name स्ट्रिंग नाम लौटाता है
D
Checks if empty जाँचता है कि क्या खाली है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) any a=42; a.type()==typeid(int) — true.
व्याख्या (हिन्दी) कोई भी a=42; a.type()==typeid(int) — सत्य।
69
EN + हिं
GB What is the output: int x=5; int y=10; cout<
IN आउटपुट क्या है: int x=5; int y=10; अदालत
A
510 510
B
105 105
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min=5, max=10. Output: 510.
व्याख्या (हिन्दी) न्यूनतम=5, अधिकतम=10. आउटपुट: 510.
70
EN + हिं
GB What is 'constexpr variable'?
IN 'constexpr वैरिएबल' क्या है?
A
Compile-time constant value संकलन-समय स्थिर मान
B
Runtime constant रनटाइम स्थिरांक
C
Static variable स्थैतिक चर
D
Same as const स्थिरांक के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) constexpr int x=42; evaluated at compile time; can be used in constant expressions.
व्याख्या (हिन्दी) constexpr int x=42; संकलन समय पर मूल्यांकन किया गया; स्थिर अभिव्यक्तियों में उपयोग किया जा सकता है।
71
EN + हिं
GB What is the output: double x=1.5; int y=x; cout<
IN आउटपुट क्या है: डबल x=1.5; int y=x; अदालत
A
1 1
B
2 2
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Truncation toward zero: 1.5→1. Output: 1.
व्याख्या (हिन्दी) शून्य की ओर कटाव: 1.5→1. आउटपुट: 1.
72
EN + हिं
GB What is 'std::clamp' in C++17?
IN C++17 में 'std::clamp' क्या है?
A
Clamps value to [lo,hi] range क्लैंप का मान [लो,हाय] रेंज तक है
B
Rounds to nearest निकटतम तक पूर्णांकित करता है
C
Absolute value पूर्ण मूल्य
D
Saturation arithmetic संतृप्ति अंकगणित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::clamp(x,lo,hi) returns lo if xhi, else x.
व्याख्या (हिन्दी) std::clamp(x,lo,hi) यदि xhi है तो वापस लौटता है, अन्यथा x पर।
73
EN + हिं
GB What is the output: int x=5; cout<
IN आउटपुट क्या है: int x=5; अदालत
A
4 4
B
5 5
C
1 1
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=5>4=hi; clamped to 4. Output: 4.
व्याख्या (हिन्दी) x=5>4=हाय; 4 से जकड़ा हुआ। आउटपुट: 4.
74
EN + हिं
GB What is 'integer sequence' std::integer_sequence?
IN 'पूर्णांक अनुक्रम' std::integer_sequence क्या है?
A
Compile-time sequence of integers for template metaprogramming टेम्प्लेट मेटाप्रोग्रामिंग के लिए पूर्णांकों का संकलन-समय अनुक्रम
B
Runtime sequence रनटाइम अनुक्रम
C
A container कंटेनर
D
A tuple variant एक टुपल वैरिएंट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::integer_sequence encodes a sequence for use with index_sequence tricks.
व्याख्या (हिन्दी) std::integer_sequence, Index_sequence ट्रिक्स के साथ उपयोग के लिए एक अनुक्रम को एनकोड करता है।
75
EN + हिं
GB What is the output: int x=5; auto [a,b]=[x,x*2]; cout<
IN आउटपुट क्या है: int x=5; ऑटो [ए,बी]=[एक्स,एक्स*2]; अदालत
A
Compile error संकलन त्रुटि
B
510 510
C
55 55
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) [x,x*2] is not valid C++ array/aggregate syntax for structured binding. Compile error.
व्याख्या (हिन्दी) [x,x*2] संरचित बाइंडिंग के लिए मान्य C++ सरणी/एग्रीगेट सिंटैक्स नहीं है। संकलन त्रुटि.
61–75 of 160