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
1036
EN + हिं
GB What is the output: template void print(T v){cout<
IN आउटपुट क्या है: टेम्पलेट शून्य प्रिंट (टी वी) {काउट
A
1 A 3.14 1 ए 3.14
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
1A3 1ए3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Prints each with space. Output: 1 A 3.14.
व्याख्या (हिन्दी) प्रत्येक को स्थान के साथ प्रिंट करता है। आउटपुट: 1 ए 3.14.
1037
EN + हिं
GB What is the output: template struct Square{static const int v=N*N;}; cout<::v;
IN आउटपुट क्या है: टेम्पलेट स्ट्रक्चर स्क्वायर {static const int v=N*N;}; अदालत
A
49 49
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7*7=49. Output: 49.
व्याख्या (हिन्दी) 7*7=49. आउटपुट: 49.
1038
EN + हिं
GB What is the output: template class Stack{vectorv; public: void push(T x){v.push_back(x);} T top(){return v.back();} int size(){return v.size();}}; Stack s; s.push(1);s.push(2);s.push(3); cout<
IN आउटपुट क्या है: टेम्पलेट क्लास स्टैक{वेक्टरव; सार्वजनिक: शून्य पुश(T x){v.push_back(x);} T टॉप(){रिटर्न v.बैक();} int आकार(){रिटर्न v.आकार();}}; ढेर एस; एस.पुश(1);एस.पुश(2);एस.पुश(3); अदालत
A
33 33
B
13 13
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) top=3, size=3. Output: 33.
व्याख्या (हिन्दी) शीर्ष=3, आकार=3. आउटपुट: 33.
1039
EN + हिं
GB What is the output: template int count(Ts...){return sizeof...(Ts);} cout<
IN आउटपुट क्या है: टेम्पलेट int count(Ts...){return sizeof...(Ts);} cout
A
5 5
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 args. Output: 5.
व्याख्या (हिन्दी) 5 तर्क. आउटपुट: 5.
1040
EN + हिं
GB What is the output: template T clamp(T v,T lo,T hi){return vhi?hi:v;} cout<
IN आउटपुट क्या है: टेम्पलेट टी क्लैंप(टी वी,टी लो,टी हाय){रिटर्न वीएचआई?हाय:वी;} कॉउट
A
5101 5101
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
5 10 1 5 10 1
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) clamp(5,1,10)=5, clamp(15,1,10)=10, clamp(-5,1,10)=1. Output: 5101.
व्याख्या (हिन्दी) क्लैंप(5,1,10)=5, क्लैंप(15,1,10)=10, क्लैंप(-5,1,10)=1। आउटपुट: 5101.
1041
EN + हिं
GB What is the output: template bool isNull(T* p){return p==nullptr;} int x=5; cout<
IN आउटपुट क्या है: टेम्पलेट बूल isNull(T* p){return p==nullptr;} int x=5; अदालत
A
01 01
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &x!=null=0; nullptr=1. Output: 01.
व्याख्या (हिन्दी) &x!=शून्य=0; nullptr=1. आउटपुट: 01.
1042
EN + हिं
GB What is the output: template struct Remove{using type=T;}; template struct Remove{using type=T;}; cout<::type,int>;
IN आउटपुट क्या है: टेम्पलेट संरचना निकालें{प्रकार=टी का उपयोग करके;}; टेम्प्लेट संरचना निकालें{प्रकार=टी का उपयोग करके;}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove::type=int. is_same=true=1. Output: 1.
व्याख्या (हिन्दी) हटाएँ::प्रकार=int. वही=सत्य=1 है. आउटपुट: 1.
1043
EN + हिं
GB What is the output: template T sumArr(T* arr,int n){T s{}; for(int i=0;i
IN आउटपुट क्या है: टेम्पलेट T sumArr(T* arr,int n){T s{}; for(int i=0;i
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
1044
EN + हिं
GB What is the output: template struct IsVoid{static const bool v=false;}; template<> struct IsVoid{static const bool v=true;}; cout<::v<::v;
IN आउटपुट क्या है: टेम्पलेट struct IsVoid{static const bool v=false;}; टेम्पलेट संरचना IsVoid{static const bool v=true;}; अदालत
A
10 10
B
01 01
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) void=1, int=0. Output: 10.
व्याख्या (हिन्दी) शून्य=1, पूर्णांक=0. आउटपुट: 10.
1045
EN + हिं
GB What is the output: template T power(T base,int exp){return exp?base*power(base,exp-1):1;} cout<
IN आउटपुट क्या है: टेम्पलेट T पॉवर(T बेस,int exp){रिटर्न exp?base*power(base,exp-1):1;} cout
A
1024 1024
B
512 512
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2^10=1024. Output: 1024.
व्याख्या (हिन्दी) 2^10=1024. आउटपुट: 1024.
1046
EN + हिं
GB What is the output: template struct GCD{static const int v=GCD::v;}; template struct GCD{static const int v=N;}; cout<::v;
IN आउटपुट क्या है: टेम्पलेट struct GCD{static const int v=GCD::v;}; टेम्पलेट संरचना GCD{static const int v=N;}; अदालत
A
6 6
B
18 18
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) GCD(48,18)=6. Output: 6.
व्याख्या (हिन्दी) जीसीडी(48,18)=6. आउटपुट: 6.
1047
EN + हिं
GB What is the output: template void swap2(T& a,T& b){T t=a;a=b;b=t;} int x=3,y=7; swap2(x,y); cout<
IN आउटपुट क्या है: टेम्पलेट void swim2(T& a,T& b){T t=a;a=b;b=t;} int x=3,y=7; स्वैप2(एक्स,वाई); अदालत
A
73 73
B
37 37
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=7,y=3. Output: 73.
व्याख्या (हिन्दी) x=7,y=3. आउटपुट: 73.
1048
EN + हिं
GB What is the output: template T abs2(T x){return x<0?-x:x;} cout<
IN आउटपुट क्या है: टेम्पलेट T abs2(T x){रिटर्न x
A
53.14 53.14
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
5 3 5 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) abs2(-5)=5, abs2(-3.14)=3.14. Output: 53.14.
व्याख्या (हिन्दी) abs2(-5)=5, abs2(-3.14)=3.14. आउटपुट: 53.14.
1049
EN + हिं
GB What is the output: template int sign(T x){return x>0?1:(x<0?-1:0);} cout<
IN आउटपुट क्या है: टेम्पलेट int साइन(T x){रिटर्न x>0?1:(x
A
-101 -101
B
-101 -101
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) sign(-5)=-1, sign(0)=0, sign(3)=1. Output: -101.
व्याख्या (हिन्दी) चिह्न(-5)=-1, चिह्न(0)=0, चिह्न(3)=1. Output: -101.
1050
EN + हिं
GB What is the output: template class Wrapper{T v; public: Wrapper(T x):v(x){} T get(){return v;} Wrapper operator+(Wrapper o){return Wrapper(v+o.v);}}; Wrappera(3),b(4); cout<<(a+b).get();
IN आउटपुट क्या है: टेम्पलेट क्लास रैपर{T v; सार्वजनिक: रैपर (टी एक्स): वी (एक्स) {} टी गेट() {रिटर्न वी;} रैपर ऑपरेटर + (रैपर ओ) {रिटर्न रैपर (वी + ओ.वी);}}; रैपपेरा(3),बी(4); अदालत
A
7 7
B
12 12
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3+4=7. Output: 7.
व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7.
1036–1050 of 1915