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
1276
EN + हिं
GB What is the output: template struct Fact{static constexpr long long v=N*Fact::v;}; template<> struct Fact<0>{static constexpr long long v=1;}; cout<::v;
IN आउटपुट क्या है: टेम्पलेट struct Fact{static constexpr long long v=N*Fact::v;}; टेम्पलेट संरचना तथ्य{static constexpr long long v=1;}; अदालत
A
3628800 3628800
B
120 120
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10!=3628800. Output: 3628800.
व्याख्या (हिन्दी) 10!=3628800. आउटपुट: 3628800.
1277
EN + हिं
GB What is the output: auto negate=[](auto f){return [=](auto...args){return !f(args...);};}; auto isEven=[](int x){return x%2==0;}; cout<
IN आउटपुट क्या है: auto negate=[](auto f){return [=](auto...args){return !f(args...);};}; ऑटो isEven=[](int x){रिटर्न x%2==0;}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) isEven(3)=false; !false=true=1. Output: 1.
व्याख्या (हिन्दी) सम(3)=झूठा है; !झूठा=सत्य=1. आउटपुट: 1.
1278
EN + हिं
GB What is the output: int f(int x){return x%2?x:f(x/2);} cout<
IN आउटपुट क्या है: int f(int x){return x%2?x:f(x/2);} cout
A
3 3
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 12->6->3(odd). Output: 3.
व्याख्या (हिन्दी) 12->6->3(विषम)। आउटपुट: 3.
1279
EN + हिं
GB What is the output: int f(int x){return x<10?f(x+1)+x:x;} cout<
IN आउटपुट क्या है: int f(int x){return x
A
50 50
B
55 55
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=f(6)+5=f(7)+6+5=...=10+9+8+7+6+5=45. Wait: f(5)=f(6)+5; f(6)=f(7)+6; f(7)=f(8)+7; f(8)=f(9)+8; f(9)=f(10)+9; f(10)=10. f(9)=19; f(8)=27; f(7)=34; f(6)=40; f(5)=45. Output: 45.
व्याख्या (हिन्दी) f(5)=f(6)+5=f(7)+6+5=...=10+9+8+7+6+5=45. रुको: f(5)=f(6)+5; f(6)=f(7)+6; f(7)=f(8)+7; f(8)=f(9)+8; f(9)=f(10)+9; एफ(10)=10. f(9)=19; f(8)=27; f(7)=34; f(6)=40; एफ(5)=45. आउटपुट: 45.
1280
EN + हिं
GB What is the output: auto pipe=[](auto...fns){return [=](auto x){(...,(x=fns(x)));return x;};}; auto fn=pipe([](int x){return x+1;},[](int x){return x*2;},[](int x){return x-3;}); cout<
IN आउटपुट क्या है: ऑटो पाइप=[](ऑटो...एफएनएस){रिटर्न [=](ऑटो x){(...,(x=fns(x)));रिटर्न x;};}; ऑटो fn=पाइप([](int x){रिटर्न x+1;},[](int x){रिटर्न x*2;},[](int x){रिटर्न x-3;}); अदालत
A
9 9
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5+1=6; 6*2=12; 12-3=9. Output: 9.
व्याख्या (हिन्दी) 5+1=6; 6*2=12; 12-3=9. आउटपुट: 9.
1281
EN + हिं
GB What is the output: int f(int x){if(x<0)return f(-x); return x<10?x:f(x%10)+f(x/10);} cout<
IN आउटपुट क्या है: int f(int x){if(x
A
6 6
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(-123)=f(123)=f(3)+f(12)=3+f(2)+f(1)=3+2+1=6. Output: 6.
व्याख्या (हिन्दी) f(-123)=f(123)=f(3)+f(12)=3+f(2)+f(1)=3+2+1=6. आउटपुट: 6.
1282
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; auto sum=accumulate(begin(a),end(a),0); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; स्वत: योग=संचय(शुरू(ए),अंत(ए),0); अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
1283
EN + हिं
GB What is the output: int a[]={3,1,4,1,5,9}; sort(begin(a),end(a)); cout<
IN आउटपुट क्या है: int a[]={3,1,4,1,5,9}; सॉर्ट करें (शुरू करें (ए), अंत (ए)); अदालत
A
49 49
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
19 19
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,1,3,4,5,9. a[2]=3,a[5]=9. Output: 39.
व्याख्या (हिन्दी) क्रमबद्ध: 1,1,3,4,5,9. ए[2]=3,ए[5]=9. आउटपुट: 39.
1284
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; auto it=v.begin()+2; v.insert(it,10); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; स्वतः यह=v.begin()+2; v.डालें(यह,10); अदालत
A
103 103
B
23 23
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After insert: {1,2,10,3,4,5}. v[2]=10,v[3]=3. Output: 103.
व्याख्या (हिन्दी) डालने के बाद: {1,2,10,3,4,5}। v[2]=10,v[3]=3. आउटपुट: 103.
1285
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int s=0; for(auto p=a;p!=a+5;++p) s+=*p; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int s=0; for(auto p=a;p!=a+5;++p) s+=*p; अदालत
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.
1286
EN + हिं
GB What is the output: vector v={5,3,8,1,9,2,7}; sort(v.begin(),v.end()); cout<
IN आउटपुट क्या है: वेक्टर v={5,3,8,1,9,2,7}; क्रमबद्ध करें (v.begin(),v.end()); अदालत
A
5 5
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,2,3,5,7,8,9. v[3]=5. Output: 5.
व्याख्या (हिन्दी) क्रमबद्ध: 1,2,3,5,7,8,9. वी[3]=5. आउटपुट: 5.
1287
EN + हिं
GB What is the output: int a[5]={1,2,3,4,5}; rotate(a,a+1,a+5); cout<
IN आउटपुट क्या है: int a[5]={1,2,3,4,5}; घुमाएँ(ए,ए+1,ए+5); अदालत
A
21 21
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[0]=2, a[4]=1. Output: 21.
व्याख्या (हिन्दी) ए[0]=2, ए[4]=1. आउटपुट: 21.
1288
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; reverse(a,a+5); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; रिवर्स(ए,ए+5); अदालत
A
531 531
B
135 135
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reversed: {5,4,3,2,1}. a[0]=5,a[2]=3,a[4]=1. Output: 531.
व्याख्या (हिन्दी) उलटा: {5,4,3,2,1}। a[0]=5,a[2]=3,a[4]=1. आउटपुट: 531.
1289
EN + हिं
GB What is the output: vector v={1,1,2,2,3,3,4}; cout<
IN आउटपुट क्या है: वेक्टर v={1,1,2,2,3,3,4}; अदालत
A
4 4
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Unique elements: 1,2,3,4 = 4. Output: 4.
व्याख्या (हिन्दी) अद्वितीय तत्व: 1,2,3,4 = 4. आउटपुट: 4.
1290
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int b[5]; copy_n(rbegin(a),5,b); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; पूर्णांक बी[5]; Copy_n(rbegin(a),5,b); अदालत
A
5 5
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) rbegin(a) starts at 5. b={5,4,3,2,1}. b[0]=5. Output: 5.
व्याख्या (हिन्दी) rbegin(a) 5 से प्रारंभ होता है। b={5,4,3,2,1}। बी[0]=5. आउटपुट: 5.
1276–1290 of 1915