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
1066
EN + हिं
GB What is the output: template T lerp(T a,T b,double t){return a+(b-a)*t;} cout<
IN आउटपुट क्या है: टेम्पलेट T lerp(T a,T b,double t){return a+(b-a)*t;} cout
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0+(10-0)*0.5=5. Output: 5.
व्याख्या (हिन्दी) 0+(10-0)*0.5=5. आउटपुट: 5.
1067
EN + हिं
GB What is the output: template T gcd(T a,T b){return b?gcd(b,a%b):a;} cout<
IN आउटपुट क्या है: टेम्पलेट T gcd(T a,T b){return b?gcd(b,a%b):a;} cout
A
12 12
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) GCD(36,48)=GCD(48,36)=GCD(36,12)=GCD(12,0)=12. Output: 12.
व्याख्या (हिन्दी) जीसीडी(36,48)=जीसीडी(48,36)=जीसीडी(36,12)=जीसीडी(12,0)=12। आउटपुट: 12.
1068
EN + हिं
GB What is the output: template vector filter(vector v,function p){vectorr;for(T x:v)if(p(x))r.push_back(x);return r;} auto r=filter({1,2,3,4,5},[](int x){return x>3;}); cout<
IN आउटपुट क्या है: टेम्पलेट वेक्टर फ़िल्टर(वेक्टर v,फ़ंक्शन p){vectorr;for(T x:v)if(p(x))r.push_back(x);return r;} auto r=filter({1,2,3,4,5},[](int x){return x>3;}); अदालत
A
2 2
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 4 and 5. size=2. Output: 2.
व्याख्या (हिन्दी) 4 और 5. आकार=2. आउटपुट: 2.
1069
EN + हिं
GB What is the output: template T reduce(vector v,T init,function f){for(T x:v) init=f(init,x);return init;} cout<({1,2,3,4,5},0,[](int a,int b){return a+b;});
IN आउटपुट क्या है: टेम्पलेट T कम करें(वेक्टर v,T init,function f){for(T x:v) init=f(init,x);रिटर्न init;} cout
A
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
1070
EN + हिं
GB What is the output: template T myMin(T a,T b){return a T myMin(T a,Rest...rest){return myMin(a,myMin(rest...));} cout<
IN आउटपुट क्या है: टेम्पलेट T myMin(T a,T b){return a
A
1 1
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) min of all = 1. Output: 1.
व्याख्या (हिन्दी) सभी का न्यूनतम = 1. आउटपुट: 1.
1071
EN + हिं
GB What is the output: template class Singleton{static T* inst; public: static T& get(){if(!inst) inst=new T; return *inst;} Singleton()=delete;}; template T* Singleton::inst=nullptr; struct Config{int x=42;}; cout<::get().x;
IN आउटपुट क्या है: टेम्प्लेट क्लास सिंगलटन {स्टेटिक टी * इंस्टा; सार्वजनिक: स्थिर T& get(){if(!inst) inst=new T; वापसी *इंस्ट;} सिंगलटन()=हटाएं;}; टेम्पलेट T* सिंगलटन::inst=nullptr; struct कॉन्फ़िग {int x=42;}; अदालत
A
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Config x=42. Output: 42.
व्याख्या (हिन्दी) कॉन्फ़िग x=42. आउटपुट: 42.
1072
EN + हिं
GB What is the output: template constexpr int sumNT=(...+Ns); cout<;
IN आउटपुट क्या है: template constexpr int sumNT=(...+Ns); अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) 1+2+3+4+5=15. आउटपुट: 15.
1073
EN + हिं
GB What is the output: template class TypeList{}; cout<,TypeList>;
IN आउटपुट क्या है: टेम्पलेट क्लास टाइपलिस्ट{}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Same template with same arg: same type. is_same=1. Output: 1.
व्याख्या (हिन्दी) समान तर्क के साथ समान टेम्पलेट: समान प्रकार। समान=1 है. आउटपुट: 1.
1074
EN + हिं
GB What is the output: template T constexprMax(T a,T b){return a>b?a:b;} constexpr int m=constexprMax(3,7); cout<
IN आउटपुट क्या है: टेम्पलेट T constexprMax(T a,T b){return a>b?a:b;} constexpr int m=constexprMax(3,7); अदालत
A
7 7
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) constexprMax(3,7)=7. Output: 7.
व्याख्या (हिन्दी) constexprMax(3,7)=7. आउटपुट: 7.
1075
EN + हिं
GB What is the output: template struct IsIntegral{static const bool v=false;}; template<> struct IsIntegral{static const bool v=true;}; template<> struct IsIntegral{static const bool v=true;}; cout<::v<::v<::v;
IN आउटपुट क्या है: टेम्पलेट struct IsIntegral{static const bool v=false;}; टेम्पलेट संरचना IsIntegral{static const bool v=true;}; टेम्पलेट संरचना IsIntegral{static const bool v=true;}; अदालत
A
101 101
B
010 010
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) int=1, double=0, long=1. Output: 101.
व्याख्या (हिन्दी) int=1, दोगुना=0, लंबा=1। आउटपुट: 101.
1076
EN + हिं
GB What is the output: template auto zip(vectora,vectorb){vector>r;for(int i=0;i({1,2,3},{4,5,6}); cout<
IN आउटपुट क्या है: टेम्पलेट ऑटो ज़िप(वेक्टोरा,वेक्टरबी){वेक्टर;for(int i=0;i
A
25 25
B
14 14
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v[1]={2,5}. first=2, second=5. Output: 25.
व्याख्या (हिन्दी) v[1]={2,5}. पहला=2, दूसरा=5. आउटपुट: 25.
1077
EN + हिं
GB What is the output: int x=5; cout<<(x*x-1)%(x+1);
IN आउटपुट क्या है: int x=5; अदालत
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (25-1)%(6)=24%6=0.
व्याख्या (हिन्दी) (25-1)%(6)=24%6=0.
1078
EN + हिं
GB What is the output: int x=5; cout<<(x+(x=10));
IN आउटपुट क्या है: int x=5; अदालत
A
Undefined behavior अपरिभाषित व्यवहार
B
15 15
C
20 20
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reading x and assigning x in same expression without sequencing is UB.
व्याख्या (हिन्दी) x को पढ़ना और अनुक्रमण के बिना एक ही अभिव्यक्ति में x निर्दिष्ट करना UB है।
1079
EN + हिं
GB What is 'std::execution::par' policy?
IN 'std::execution::par' नीति क्या है?
A
Parallel algorithm execution policy (C++17) समानांतर एल्गोरिथम निष्पादन नीति (C++17)
B
Sequential execution अनुक्रमिक निष्पादन
C
GPU execution जीपीयू निष्पादन
D
Thread pool only केवल थ्रेड पूल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::sort(std::execution::par, ...) uses parallel execution if supported.
व्याख्या (हिन्दी) std::sort(std::execution::par, ...) यदि समर्थित हो तो समानांतर निष्पादन का उपयोग करता है।
1080
EN + हिं
GB What is the output: cout<::min()+numeric_limits::max();
IN आउटपुट क्या है: cout
A
-1 -1
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) INT_MIN+INT_MAX = -2147483648+2147483647 = -1. Output: -1.
व्याख्या (हिन्दी) INT_MIN+INT_MAX = -2147483648+2147483647 = -1. आउटपुट:-1.
1066–1080 of 1915