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
121
EN + हिं
GB What is 'std::make_signed' and 'std::make_unsigned'?
IN 'std::make_signed' और 'std::make_unsigned' क्या है?
A
Convert integer type to signed/unsigned equivalent पूर्णांक प्रकार को हस्ताक्षरित/अहस्ताक्षरित समकक्ष में बदलें
B
Cast operators कास्ट ऑपरेटर
C
Runtime conversion रनटाइम रूपांतरण
D
Type erasure मिटाना टाइप करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_signed_t=int; make_unsigned_t=unsigned int.
व्याख्या (हिन्दी) make_signed_t=int; make_unsigned_t=unsigned int.
122
EN + हिं
GB What is the output: cout<,unsigned int>;
IN आउटपुट क्या है: cout
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) make_unsigned_t=unsigned int. is_same=1. Output: 1.
व्याख्या (हिन्दी) make_unsigned_t=unsigned int. समान=1 है. आउटपुट: 1.
123
EN + हिं
GB What is 'std::conditional_t'?
IN 'std::conditional_t' क्या है?
A
Selects T or F based on bool condition at compile time संकलन समय पर बूल स्थिति के आधार पर टी या एफ का चयन करता है
B
Runtime if-else रनटाइम यदि-अन्यथा
C
A ternary operator एक टर्नरी ऑपरेटर
D
Same as enable_if Enable_if के समान
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) conditional_t=int; conditional_t=double.
व्याख्या (हिन्दी) सशर्त_t=int; सशर्त_टी=दोगुना।
124
EN + हिं
GB What is the output: using T=conditional_t<(sizeof(int)>2),int,short>; cout<
IN आउटपुट क्या है: T=conditional_t2),int,short> का उपयोग करना; अदालत
A
4 4
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sizeof(int)=4>2: true; T=int; sizeof=4. Output: 4.
व्याख्या (हिन्दी) sizeof(int)=4>2: सत्य; टी=इंट; आकार=4. आउटपुट: 4.
125
EN + हिं
GB What is 'std::void_t'?
IN 'std::void_t' क्या है?
A
Maps any types to void; used for SFINAE detection शून्य करने के लिए किसी भी प्रकार के मानचित्र; SFINAE का पता लगाने के लिए उपयोग किया जाता है
B
A void alias एक शून्य उपनाम
C
Removes types प्रकार हटाता है
D
A concept संप्रत्यय
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) void_t fails if T has no 'type' member; enables has_type_member trait.
व्याख्या (हिन्दी) यदि T में कोई 'प्रकार' सदस्य नहीं है तो void_t विफल हो जाता है; has_type_member विशेषता को सक्षम करता है।
126
EN + हिं
GB What is the output: int x=-5; cout<<(x>>1);
IN आउटपुट क्या है: int x=-5; cout1);
A
Implementation-defined कार्यान्वयन-परिभाषित
B
-3 -3
C
-2 -2
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) See explanation.
व्याख्या (हिन्दी) स्पष्टीकरण देखें.
127
EN + हिं
GB What is the output: int x=5; auto& r=x; const auto& cr=x; cout<
IN आउटपुट क्या है: int x=5; ऑटो&r=x; स्थिरांक ऑटो& cr=x; अदालत
A
55 55
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
50 50
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both read x=5. Output: 55.
व्याख्या (हिन्दी) दोनों x=5 पढ़ते हैं। आउटपुट: 55.
128
EN + हिं
GB What is the output: volatile int x=5; cout<
IN आउटपुट क्या है: volatile int x=5; अदालत
A
5 5
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) volatile doesn't change value; just forces memory read. Output: 5.
व्याख्या (हिन्दी) अस्थिर मूल्य नहीं बदलता है; बस स्मृति को पढ़ने पर मजबूर करता है। आउटपुट: 5.
129
EN + हिं
GB What is the output: const int x=5; auto y=x; y=10; cout<
IN आउटपुट क्या है: const int x=5; ऑटो y=x; y=10; अदालत
A
510 510
B
55 55
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto y=x strips const; y is mutable copy. x=5,y=10. Output: 510.
व्याख्या (हिन्दी) ऑटो y=x स्ट्रिप्स स्थिरांक; y परिवर्तनशील प्रति है। x=5,y=10. आउटपुट: 510.
130
EN + हिं
GB What is the output: int x=5; decltype(auto) r=x; r=10; cout<
IN आउटपुट क्या है: int x=5; डिक्लटाइप(ऑटो) r=x; आर=10; अदालत
A
5 5
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) decltype(auto) r=x deduces int (not ref, since x is lvalue expression). r is int. r=10 doesn't affect x. Output: 5. Wait: decltype(x) is int, so r is int copy. x=5. Actually decltype(auto) of a plain name is int, not int&. Output: 5.
व्याख्या (हिन्दी) decltype(auto) r=x int को घटाता है (रेफ नहीं, क्योंकि x लैवल्यू एक्सप्रेशन है)। आर पूर्णांक है. r=10 x को प्रभावित नहीं करता. आउटपुट: 5. प्रतीक्षा करें: decltype(x) int है, इसलिए r int कॉपी है। एक्स=5. वास्तव में सादे नाम का डिक्लटाइप (ऑटो) int है, int& नहीं। आउटपुट: 5.
131
EN + हिं
GB What is the output: int x=5,y=10; auto [a,b]=make_pair(x,y); a=99; cout<
IN आउटपुट क्या है: int x=5,y=10; ऑटो [ए,बी]=मेक_पेयर(एक्स,वाई); ए=99; अदालत
A
510 510
B
9910 9910
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a is copy; a=99 doesn't affect x. b=10. Output: 510.
व्याख्या (हिन्दी) ए प्रतिलिपि है; a=99 x को प्रभावित नहीं करता. बी=10. आउटपुट: 510.
132
EN + हिं
GB What is the output: int x=5; int& r=x; auto y=r; y=99; cout<
IN आउटपुट क्या है: int x=5; int& r=x; ऑटो y=r; y=99; अदालत
A
5 5
B
99 99
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) auto y=r: strips reference, y is int copy. y=99 doesn't affect x. Output: 5.
व्याख्या (हिन्दी) ऑटो y=r: स्ट्रिप्स संदर्भ, y इंट कॉपी है। y=99 x को प्रभावित नहीं करता. आउटपुट: 5.
133
EN + हिं
GB What is the output: char c='A'; int x=c; cout<
IN आउटपुट क्या है: char c='A'; int x=c; अदालत
A
65 65
B
A
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'A'=65. Output: 65.
व्याख्या (हिन्दी) 'ए'=65. आउटपुट: 65.
134
EN + हिं
GB What is the output: bool b=false; int x=b+b+b; cout<
IN आउटपुट क्या है: bool b=false; int x=b+b+b; अदालत
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0+0+0=0. Output: 0.
व्याख्या (हिन्दी) 0+0+0=0. आउटपुट: 0.
135
EN + हिं
GB What is the output: int x=INT_MAX-1; x+=2; cout<
IN आउटपुट क्या है: int x=INT_MAX-1; एक्स+=2; अदालत
A
Undefined behavior अपरिभाषित व्यवहार
B
INT_MIN+1 INT_MIN+1
C
Compile error संकलन त्रुटि
D
1 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INT_MAX-1+2 = INT_MAX+1: signed overflow = UB.
व्याख्या (हिन्दी) INT_MAX-1+2 = INT_MAX+1: हस्ताक्षरित अतिप्रवाह = यूबी।
121–135 of 160