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
1051
EN + हिं
GB What is the output: template bool between(T v,T lo,T hi){return v>=lo&&v<=hi;} cout<
IN आउटपुट क्या है: टेम्पलेट बूल बीच(टी वी,टी लो,टी हाय){रिटर्न वी>=लो&&वी
A
10 10
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 in [1,10]=1; 15 not=0. Output: 10.
व्याख्या (हिन्दी) 5 में [1,10]=1; 15 नहीं=0. आउटपुट: 10.
1052
EN + हिं
GB What is the output: template T addOne(T x){return x+1;} cout<
IN आउटपुट क्या है: टेम्पलेट T addOne(T x){return x+1;} cout
A
6 6
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) addOne(5)=6. Output: 6.
व्याख्या (हिन्दी) ऐडवन(5)=6. आउटपुट: 6.
1053
EN + हिं
GB What is the output: template struct TypeOf{static string name(){return "unknown";}}; template<> struct TypeOf{static string name(){return "int";}}; cout<::name()<::name();
IN आउटपुट क्या है: टेम्प्लेट स्ट्रक्चर टाइपऑफ़ {स्टैटिक स्ट्रिंग नेम() {रिटर्न "अज्ञात";}}; टेम्प्लेट संरचना प्रकारOf{स्थैतिक स्ट्रिंग नाम(){वापसी "int";}}; अदालत
A
intunknown अनजान
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
int double इंट डबल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) TypeOf=int; TypeOf=unknown. Output: intunknown.
व्याख्या (हिन्दी) टाइपऑफ=इंट; टाइपऑफ=अज्ञात. आउटपुट: अज्ञात.
1054
EN + हिं
GB What is the output: template struct Array{T d[N]; int size(){return N;} T& at(int i){return d[i];}}; Array a; a.at(0)=1;a.at(1)=2;a.at(2)=3; cout<
IN आउटपुट क्या है: टेम्पलेट स्ट्रक्चर ऐरे {टी डी [एन]; int size(){return N;} T& at(int i){return d[i];}}; सरणी ए; a.at(0)=1;a.at(1)=2;a.at(2)=3; अदालत
A
32 32
B
31 31
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) size=3, at(1)=2. Output: 32.
व्याख्या (हिन्दी) आकार=3, पर(1)=2. आउटपुट: 32.
1055
EN + हिं
GB What is the output: template T myMax(initializer_list il){return *max_element(il.begin(),il.end());} cout<
IN आउटपुट क्या है: टेम्पलेट T myMax(initializer_list il){return *max_element(il.begin(),il.end());} cout
A
9 9
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=9. Output: 9.
व्याख्या (हिन्दी) अधिकतम=9. आउटपुट: 9.
1056
EN + हिं
GB What is the output: template auto product(Args... args){return (args*...);} cout<
IN आउटपुट क्या है: टेम्प्लेट ऑटो प्रोडक्ट(आर्ग...आर्ग){रिटर्न (आर्ग*...);} कॉउट
A
120 120
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*2*3*4*5=120. Output: 120.
व्याख्या (हिन्दी) 1*2*3*4*5=120. आउटपुट: 120.
1057
EN + हिं
GB What is the output: template T fromString(const string& s); template<> int fromString(const string& s){return stoi(s);} cout<("42");
IN आउटपुट क्या है: टेम्पलेट T fromString(const string& s); टेम्पलेट int fromString(const string& s){return Stoi(s);} cout
A
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) fromString("42")=42. Output: 42.
व्याख्या (हिन्दी) fromString("42")=42. आउटपुट: 42.
1058
EN + हिं
GB What is the output: template struct Cond{using type=T;}; template struct Cond{using type=F;}; cout<::type,int>;
IN आउटपुट क्या है: template struct Cond{using type=T;}; टेम्पलेट संरचना Cond{उपयोग प्रकार=F;}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) true: type=int. is_same=1. Output: 1.
व्याख्या (हिन्दी) सत्य: प्रकार=int. समान=1 है. आउटपुट: 1.
1059
EN + हिं
GB What is the output: template struct Decay{using type=remove_cvref_t;}; cout<::type,int>;
IN आउटपुट क्या है: टेम्पलेट संरचना क्षय{उपयोग प्रकार=निकालें_cvref_t;}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) remove_cvref removes const and &. type=int. is_same=1. Output: 1.
व्याख्या (हिन्दी) delete_cvref स्थिरांक और & को हटा देता है। टाइप=इंट. समान=1 है. आउटपुट: 1.
1060
EN + हिं
GB What is the output: template void f(T){cout<<'T';} template<> void f(int){cout<<'I';} f(1); f(1.0); f('a');
IN आउटपुट क्या है: टेम्पलेट शून्य f(T){cout
A
ITT आईटीटी
B
TTT टीटीटी
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(1): T=int: 'I'. f(1.0): T=double: 'T'. f('a'): T=char: 'T'. Output: ITT.
व्याख्या (हिन्दी) एफ(1): टी=इंट: 'आई'। एफ(1.0): टी=डबल: 'टी'। एफ('ए'): टी=चार: 'टी'। आउटपुट: आईटीटी।
1061
EN + हिं
GB What is the output: template auto makeVec(T a,T b,T c)->vector{return {a,b,c};} auto v=makeVec(1,2,3); cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो मेकवेक(टी ए,टी बी,टी सी)->वेक्टर{रिटर्न {ए,बी,सी};} ऑटो वी=मेकवेक(1,2,3); अदालत
A
4 4
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v[0]=1,v[2]=3. 1+3=4. Output: 4.
व्याख्या (हिन्दी) v[0]=1,v[2]=3. 1+3=4. आउटपुट: 4.
1062
EN + हिं
GB What is the output: template struct Twice{using type=pair;}; Twice::type p={3,4}; cout<
IN आउटपुट क्या है: टेम्पलेट संरचना दो बार {उपयोग प्रकार = जोड़ी;}; दो बार::टाइप करें p={3,4}; अदालत
A
34 34
B
43 43
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) pair{3,4}. first=3,second=4. Output: 34.
व्याख्या (हिन्दी) जोड़ी{3,4}. पहला=3, दूसरा=4. आउटपुट: 34.
1063
EN + हिं
GB What is the output: template constexpr auto makeArray(){array a{}; for(size_t i=0;i(); cout<
IN आउटपुट क्या है: template constexpr auto makeArray(){array a{}; for(size_t i=0;i
A
9 9
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[3]=3*3=9. Output: 9.
व्याख्या (हिन्दी) ए[3]=3*3=9. आउटपुट: 9.
1064
EN + हिं
GB What is the output: template class Optional{bool has=false; T v; public: void set(T x){has=true;v=x;} bool hasVal(){return has;} T get(){return v;}}; Optional o; cout<
IN आउटपुट क्या है: टेम्पलेट क्लास वैकल्पिक {बूल है = गलत; टी वी; सार्वजनिक: void set(T x){has=true;v=x;} bool hasVal(){return has;} T get(){return v;}}; वैकल्पिक ओ; अदालत
A
015 015
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
0 1 5 0 1 5
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Initial: 0. After set: 1, get=5. Output: 015.
व्याख्या (हिन्दी) आरंभिक: 0. सेट के बाद: 1, प्राप्त करें=5. आउटपुट: 015.
1065
EN + हिं
GB What is the output: template int countIf(vector& v,Pred p){int n=0;for(auto x:v) if(p(x)) n++;return n;} vectorv={1,2,3,4,5}; cout<
IN आउटपुट क्या है: टेम्पलेट int countIf(वेक्टर& v,Pred p){int n=0;for(auto x:v) if(p(x)) n++;रिटर्न n;} वेक्टरv={1,2,3,4,5}; अदालत
A
2 2
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2 and 4 are even. count=2. Output: 2.
व्याख्या (हिन्दी) 2 और 4 सम हैं. गिनती=2. आउटपुट: 2.
1051–1065 of 1915