OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 140 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
140 questions
106
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<<*(find_if(a,a+5,[](int x){return x>3;}))+1;
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
5 5
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First >3 is 4. 4+1=5. Output: 5.
व्याख्या (हिन्दी) पहला >3 4 है। 4+1=5। आउटपुट: 5.
107
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) equal_range gives [it1,it2); 3 appears once. Distance=1. Output: 1.
व्याख्या (हिन्दी) बराबर_रेंज देता है [it1,it2); 3 एक बार प्रकट होता है. दूरी=1. आउटपुट: 1.
108
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int s=0; for(int i=0;i<5;i+=2) s+=a[i]; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int s=0; for(int i=0;i
A
9 9
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[0]+a[2]+a[4]=1+3+5=9. Output: 9.
व्याख्या (हिन्दी) a[0]+a[2]+a[4]=1+3+5=9. आउटपुट: 9.
109
EN + हिं
GB What is the output: int a[]={3,1,4,1,5,9,2,6,5}; sort(a,a+9); cout<
IN आउटपुट क्या है: int a[]={3,1,4,1,5,9,2,6,5}; क्रमबद्ध करें(ए,ए+9); अदालत
A
4 4
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,1,2,3,4,5,5,6,9. a[4]=4. Output: 4.
व्याख्या (हिन्दी) क्रमबद्ध: 1,1,2,3,4,5,5,6,9। ए[4]=4. आउटपुट: 4.
110
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=begin(a),*q=end(a)-1; cout<<*p+*q;
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=begin(a),*q=end(a)-1; अदालत
A
6 6
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+5=6. Output: 6.
व्याख्या (हिन्दी) 1+5=6. आउटपुट: 6.
111
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; for(auto it=v.rbegin();it!=v.rend();++it) cout<<*it;
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; for(auto it=v.rbegin();it!=v.rend();++it) cout
A
54321 54321
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Reversed. Output: 54321.
व्याख्या (हिन्दी) उलटा। आउटपुट: 54321.
112
EN + हिं
GB What is the output: int a[3][3]={{9,8,7},{6,5,4},{3,2,1}}; int s=0; for(int i=0;i<3;i++) s+=a[i][2-i]; cout<
IN आउटपुट क्या है: int a[3][3]={{9,8,7},{6,5,4},{3,2,1}}; int s=0; for(int i=0;i
A
15 15
B
9 9
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[0][2]=7, a[1][1]=5, a[2][0]=3. 7+5+3=15. Output: 15.
व्याख्या (हिन्दी) ए[0][2]=7, ए[1][1]=5, ए[2][0]=3। 7+5+3=15. आउटपुट: 15.
113
EN + हिं
GB What is the output: int a[]={2,3,5,7,11,13}; cout<<*upper_bound(a,a+6,7);
IN आउटपुट क्या है: int a[]={2,3,5,7,11,13}; अदालत
A
11 11
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First element > 7 is 11. Output: 11.
व्याख्या (हिन्दी) पहला तत्व > 7 11 है। आउटपुट: 11।
114
EN + हिं
GB What is the output: vector v={5,3,8,1,9}; auto m=max_element(v.begin(),v.end()); *m=0; cout<
IN आउटपुट क्या है: वेक्टर v={5,3,8,1,9}; ऑटो m=max_element(v.begin(),v.end()); *एम=0; अदालत
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max is 9 at v[4]. *m=0 changes v[4]. v[2]=8. Output: 8.
व्याख्या (हिन्दी) v[4] पर अधिकतम 9 है। *m=0 परिवर्तन v[4]। वी[2]=8. आउटपुट: 8.
115
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
120 120
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*1*2*3*4*5=120. Output: 120.
व्याख्या (हिन्दी) 1*1*2*3*4*5=120. आउटपुट: 120.
116
EN + हिं
GB What is the output: string words[]={"","hello","","world",""}; int c=count_if(begin(words),end(words),[](const string&s){return !s.empty();});cout<
IN आउटपुट क्या है: स्ट्रिंग शब्द[]={"","हैलो","","दुनिया",""}; int c=count_if(begin(words),end(words),[](const string&s){return !s.empty();});cout
A
2 2
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) hello and world. count=2. Output: 2.
व्याख्या (हिन्दी) नमस्ते और दुनिया. गिनती=2. आउटपुट: 2.
117
EN + हिं
GB What is the output: int a[]={10,20,30,40,50}; transform(a,a+5,a,[](int x){return x/10;}); cout<
IN आउटपुट क्या है: int a[]={10,20,30,40,50}; परिवर्तन(ए,ए+5,ए,[](int x){रिटर्न x/10;}); अदालत
A
15 15
B
51 51
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a={1,2,3,4,5}. a[0]=1,a[4]=5. Output: 15.
व्याख्या (हिन्दी) ए={1,2,3,4,5}। ए[0]=1,ए[4]=5. आउटपुट: 15.
118
EN + हिं
GB What is the output: int a[]={1,3,5,7,9}; cout<<*lower_bound(a,a+5,5);
IN आउटपुट क्या है: int a[]={1,3,5,7,9}; अदालत
A
5 5
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First >= 5 is 5. Output: 5.
व्याख्या (हिन्दी) प्रथम >=5, 5 है। आउटपुट: 5।
119
EN + हिं
GB What is the output: int a[10]={0}; generate(a,a+10,[n=0]()mutable{return n+=2;}); cout<
IN आउटपुट क्या है: int a[10]={0}; generate(a,a+10,[n=0]()mutable{return n+=2;}); अदालत
A
10 10
B
8 8
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2,4,6,8,10,... a[4]=10. Output: 10.
व्याख्या (हिन्दी) 2,4,6,8,10,...ए[4]=10। आउटपुट: 10.
120
EN + हिं
GB What is the output: vector a={1,2,3},b={4,5,6},c; merge(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c)); cout<
IN आउटपुट क्या है: वेक्टर a={1,2,3},b={4,5,6},c; मर्ज(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c)); अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Merged: 1,2,3,4,5,6. c[3]=4. Output: 4.
व्याख्या (हिन्दी) मर्ज: 1,2,3,4,5,6. सी[3]=4. आउटपुट: 4.
106–120 of 140