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
31
EN + हिं
GB What is the output: int a=1,b=2; cout<
IN आउटपुट क्या है: int a=1,b=2; अदालत
A
4 4
B
3 3
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a+++b is parsed as (a++)+b = 1+2 = 3 (maximal munch). a becomes 2 after.
व्याख्या (हिन्दी) a+++b को (a++)+b = 1+2 = 3 (अधिकतम चबाना) के रूप में पार्स किया गया है। a बाद में 2 हो जाता है।
32
EN + हिं
GB What is the size of std::byte?
IN एसटीडी::बाइट का आकार क्या है?
A
1 1
B
8 8
C
Platform-dependent प्लेटफार्म पर निर्भर
D
Same as char चार के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::byte (C++17) is defined as an enum class backed by unsigned char, so sizeof(std::byte) == sizeof(unsigned char) == 1.
व्याख्या (हिन्दी) std::byte (C++17) को unsigned char द्वारा समर्थित एक enum क्लास के रूप में परिभाषित किया गया है, इसलिए sizeof(std::byte) == sizeof(unsigned char) == 1.
33
EN + हिं
GB What is the output: int x=0; cout<<(x?'T':'F');
IN आउटपुट क्या है: int x=0; अदालत
A
F एफ
B
T टी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0 is false; ternary returns 'F'. Output: F.
व्याख्या (हिन्दी) 0 गलत है; टर्नरी रिटर्न 'एफ'। आउटपुट: एफ.
34
EN + हिं
GB What is 'value category' in C++?
IN C++ में 'मूल्य श्रेणी' क्या है?
A
lvalue/prvalue/xvalue: classifies expressions lvalue/prvalue/xvalue: भावों को वर्गीकृत करता है
B
Data type category डेटा प्रकार श्रेणी
C
Template category टेम्पलेट श्रेणी
D
Storage class भंडारण वर्ग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Value categories determine move/copy semantics and whether address can be taken.
व्याख्या (हिन्दी) मूल्य श्रेणियां चाल/कॉपी शब्दार्थ निर्धारित करती हैं और क्या पता लिया जा सकता है।
35
EN + हिं
GB What is the output: long long x=1234567890123; cout<
IN आउटपुट क्या है: long long x=1234567890123; अदालत
A
1234567890123 1234567890123
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Truncated छंटनी की गई
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Long long holds up to ~9.2e18. Output: 1234567890123.
व्याख्या (हिन्दी) ~9.2e18 तक लंबे समय तक टिके रहते हैं। आउटपुट: 1234567890123।
36
EN + हिं
GB What is 'std::numeric_limits::epsilon()'?
IN 'std::numeric_limits::epsilon()' क्या है?
A
Smallest float difference from 1.0 1.0 से सबसे छोटा फ्लोट अंतर
B
Machine precision मशीन परिशुद्धता
C
Float max value फ़्लोट अधिकतम मान
D
Float min positive फ्लोट न्यूनतम सकारात्मक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) epsilon is the smallest float e such that 1.0+e != 1.0; ~1.19e-7 for float.
व्याख्या (हिन्दी) एप्सिलॉन सबसे छोटा फ्लोट ई है जैसे कि 1.0+e != 1.0; फ्लोट के लिए ~1.19e-7।
37
EN + हिं
GB What is the output: int x=5; auto y=x; auto& z=x; z=10; cout<
IN आउटपुट क्या है: int x=5; ऑटो y=x; ऑटो& z=x; z=10; अदालत
A
105 105
B
1010 1010
C
55 55
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) z is ref to x; z=10 sets x=10. y is copy=5. Output: 105.
व्याख्या (हिन्दी) z, x का संदर्भ है; z=10 सेट x=10. y प्रतिलिपि = 5 है। आउटपुट: 105.
38
EN + हिं
GB What is 'integer literal suffix'?
IN 'पूर्णांक शाब्दिक प्रत्यय' क्या है?
A
L/LL/U/UL/ULL specifying type of literal एल/एलएल/यू/यूएल/यूएलएल शाब्दिक प्रकार निर्दिष्ट करता है
B
Hexadecimal prefix हेक्साडेसिमल उपसर्ग
C
Binary prefix बाइनरी उपसर्ग
D
Octal prefix अष्टक उपसर्ग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 42LL is long long; 42U is unsigned int; 42ULL is unsigned long long.
व्याख्या (हिन्दी) 42LL लंबा लंबा है; 42यू अहस्ताक्षरित पूर्णांक है; 42ULL लंबे समय से अहस्ताक्षरित है।
39
EN + हिं
GB What is the output: int x=10; double y=3; cout<
IN आउटपुट क्या है: int x=10; दोगुना y=3; अदालत
A
3.33333 3.33333
B
3 3
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x promoted to double: 10.0/3.0=3.333... Output: 3.33333.
व्याख्या (हिन्दी) x को दोगुना कर दिया गया: 10.0/3.0=3.333... आउटपुट: 3.33333।
40
EN + हिं
GB What is 'structured binding' for struct?
IN संरचना के लिए 'संरचित बाइंडिंग' क्या है?
A
auto [x,y]=myStruct; binds members to names ऑटो [x,y]=myStruct; सदस्यों को नामों से बांधता है
B
Pointer binding सूचक बाइंडिंग
C
Reference binding संदर्भ बाइंडिंग
D
Runtime only केवल रनटाइम
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++17: struct A{int x,y;}; A a{1,2}; auto [x,y]=a; gives x=1,y=2.
व्याख्या (हिन्दी) सी++17: संरचना ए{int x,y;}; ए ए{1,2}; ऑटो [x,y]=a; x=1,y=2 देता है।
41
EN + हिं
GB What is the output: float f=1.0f/0.0f; cout<
IN आउटपुट क्या है: फ्लोट f=1.0f/0.0f; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Float division by zero gives infinity; isinf=true=1. Output: 1.
व्याख्या (हिन्दी) फ्लोट को शून्य से विभाजित करने पर अनंतता मिलती है; inf=सत्य=1. आउटपुट: 1.
42
EN + हिं
GB What is 'std::monostate'?
IN 'std::monostate' क्या है?
A
Empty type usable as first variant alternative प्रथम प्रकार के विकल्प के रूप में प्रयोग करने योग्य खाली प्रकार
B
A null type एक शून्य प्रकार
C
An empty class एक खाली कक्षा
D
Same as void शून्य के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::variant allows default-constructible variant with empty state.
व्याख्या (हिन्दी) std::variant खाली स्थिति के साथ डिफ़ॉल्ट-निर्माण योग्य संस्करण की अनुमति देता है।
43
EN + हिं
GB What is the output: int x=5; cout<<(x%2==0?"even":"odd")<<' '<
IN आउटपुट क्या है: int x=5; अदालत
A
odd 5 विषम 5
B
even 5 सम 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5%2=1!=0: odd. Output: odd 5.
व्याख्या (हिन्दी) 5%2=1!=0: विषम। आउटपुट: विषम 5.
44
EN + हिं
GB What is 'std::optional::value_or'?
IN 'std::optional::value_or' क्या है?
A
Returns value if present, else default यदि मौजूद है तो मान लौटाता है, अन्यथा डिफ़ॉल्ट
B
Throws if empty खाली हो तो फेंक देता है
C
Same as *opt *ऑप्ट के समान
D
Converts to bool बूल में परिवर्तित हो जाता है
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) opt.value_or(42) returns opt's value if has_value(), else 42.
व्याख्या (हिन्दी) opt.value_or(42) यदि has_value() है तो opt का मान लौटाता है, अन्यथा 42।
45
EN + हिं
GB What is the output: int x=1000; char c=x; cout<<(int)c;
IN आउटपुट क्या है: int x=1000; चार सी=एक्स; अदालत
A
Impl-defined इम्प्लांट-परिभाषित
B
-24 -24
C
232 232
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1000%256=232 as unsigned; as signed char: 232-256=-24. Implementation-defined.
व्याख्या (हिन्दी) 1000%256=232 अहस्ताक्षरित के रूप में; हस्ताक्षरित वर्ण के अनुसार: 232-256=-24। कार्यान्वयन-परिभाषित।
31–45 of 160