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
556
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) — सत्य।
557
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.
558
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; संकलन समय पर मूल्यांकन किया गया; स्थिर अभिव्यक्तियों में उपयोग किया जा सकता है।
559
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.
560
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 पर।
561
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.
562
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 ट्रिक्स के साथ उपयोग के लिए एक अनुक्रम को एनकोड करता है।
563
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++ सरणी/एग्रीगेट सिंटैक्स नहीं है। संकलन त्रुटि.
564
EN + हिं
GB What is 'std::numeric_limits::digits'?
IN 'std::numeric_limits::digits' क्या है?
A
Number of binary digits (bits-1 for signed) बाइनरी अंकों की संख्या (हस्ताक्षरित के लिए बिट्स-1)
B
Total bits कुल बिट्स
C
Decimal digits दशमलव अंक
D
Significant digits महत्वपूर्ण अंक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) digits for signed int=31 (excludes sign bit); for unsigned int=32.
व्याख्या (हिन्दी) हस्ताक्षरित int=31 के लिए अंक (साइन बिट को छोड़कर); अहस्ताक्षरित int=32 के लिए।
565
EN + हिं
GB What is the output: int x=5; cout<<(x*2==10)<<(x/2==2)<<(x%2==1);
IN आउटपुट क्या है: int x=5; अदालत
A
111 111
B
110 110
C
011 011
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10==10=1, 2==2=1, 1==1=1. Output: 111.
व्याख्या (हिन्दी) 10==10=1, 2==2=1, 1==1=1. आउटपुट: 111.
566
EN + हिं
GB What is 'volatile const' combination?
IN 'वाष्पशील स्थिरांक' संयोजन क्या है?
A
Read-only variable whose value may change externally केवल पढ़ने योग्य वैरिएबल जिसका मान बाह्य रूप से बदल सकता है
B
Useless combination बेकार संयोजन
C
Compile error संकलन त्रुटि
D
Same as const स्थिरांक के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) const volatile int reg: can't modify in code but hardware may change it; must read from memory each time.
व्याख्या (हिन्दी) const volatile int reg: कोड में संशोधन नहीं किया जा सकता लेकिन हार्डवेयर इसे बदल सकता है; हर बार याददाश्त से पढ़ना चाहिए।
567
EN + हिं
GB What is the output: int x=-5; cout<
IN आउटपुट क्या है: int x=-5; अदालत
A
5 5
B
-5 -5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::abs(-5)=5. Output: 5.
व्याख्या (हिन्दी) std::abs(-5)=5. आउटपुट: 5.
568
EN + हिं
GB What is 'std::tuple_size'?
IN 'std::tuple_size' क्या है?
A
Compile-time number of elements in tuple/pair/array टपल/जोड़ी/सरणी में तत्वों की संकलन-समय संख्या
B
Runtime size रनटाइम आकार
C
Iterator count पुनरावर्तक गिनती
D
Type count गिनती टाइप करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) tuple_size>::value = 3 at compile time.
व्याख्या (हिन्दी) संकलन समय पर Tuple_size::value = 3।
569
EN + हिं
GB What is the output: auto x=3.14; auto y=3.14f; cout<<(sizeof(x)==sizeof(y));
IN आउटपुट क्या है: ऑटो x=3.14; ऑटो y=3.14f; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof(double)=8, sizeof(float)=4. 8==4=false=0. Output: 0.
व्याख्या (हिन्दी) आकार(डबल)=8, आकार(फ्लोट)=4. 8==4=असत्य=0. आउटपुट: 0.
570
EN + हिं
GB What is 'std::get(tuple)'?
IN 'std::get(tuple)' क्या है?
A
Access Nth element of tuple at compile time संकलन समय पर टुपल के Nवें तत्व तक पहुंचें
B
Runtime element access रनटाइम तत्व पहुंच
C
Type-erased access टाइप-मिटाई गई पहुंच
D
Iterator access इटरेटर पहुंच
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto t=make_tuple(1,2.0,'a'); std::get<1>(t)=2.0.
व्याख्या (हिन्दी) ऑटो t=make_tuple(1,2.0,'a'); std::get(t)=2.0.
556–570 of 1915