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
121
EN + हिं
GB What is the output: int a[]={5,4,3,2,1}; int b[5]; partial_sort_copy(a,a+5,b,b+5); cout<
IN आउटपुट क्या है: int a[]={5,4,3,2,1}; पूर्णांक बी[5]; आंशिक_सॉर्ट_कॉपी(ए,ए+5,बी,बी+5); अदालत
A
15 15
B
51 51
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted copy: 1,2,3,4,5. b[0]=1,b[4]=5. Output: 15.
व्याख्या (हिन्दी) क्रमबद्ध प्रति: 1,2,3,4,5. बी[0]=1,बी[4]=5. आउटपुट: 15.
122
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int* it=remove(a,a+5,3); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int* it=remove(a,a+5,3); अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After remove: {1,2,4,5,_}. New end = a+4. Distance=4. Output: 4.
व्याख्या (हिन्दी) हटाने के बाद: {1,2,4,5,_}। नया अंत = ए+4. दूरी=4. आउटपुट: 4.
123
EN + हिं
GB What is the output: int a[5]; fill_n(a,5,3); cout<
IN आउटपुट क्या है: int a[5]; fill_n(ए,5,3); अदालत
A
45 45
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3^2*5=9*5=45. Output: 45.
व्याख्या (हिन्दी) 3^2*5=9*5=45. आउटपुट: 45.
124
EN + हिं
GB What is the output: vector> v={{3,"c"},{1,"a"},{2,"b"}}; sort(v.begin(),v.end()); cout<
IN आउटपुट क्या है: वेक्टर v={{3,"c"},{1,"a"},{2,"b"}}; क्रमबद्ध करें (v.begin(),v.end()); अदालत
A
ac ए.सी
B
ca सीए
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: (1,a),(2,b),(3,c). v[0].second=a, v[2].second=c. Output: ac.
व्याख्या (हिन्दी) क्रमबद्ध: (1,ए),(2,बी),(3,सी)। v[0].सेकंड=ए, वी[2].सेकंड=सी. आउटपुट: एसी.
125
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<());
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1<2: not descending. Output: 0.
व्याख्या (हिन्दी) 1
126
EN + हिं
GB What is the output: array a; iota(a.begin(),a.end(),2); cout<
IN आउटपुट क्या है: array a; iota(a.begin(),a.end(),2); अदालत
A
26 26
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a={2,3,4,5,6}. a[0]=2,a[4]=6. Output: 26.
व्याख्या (हिन्दी) ए={2,3,4,5,6}। ए[0]=2,ए[4]=6. आउटपुट: 26.
127
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; copy_if(a,a+5,ostream_iterator(cout,' '),[](int x){return x*x>8;});
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; Copy_if(a,a+5,ostream_iterator(cout,' '),[](int x){return x*x>8;});
A
3 4 5 3 4 5
B
4 5 4 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3^2=9>8, 4^2=16>8, 5^2=25>8. Output: 3 4 5.
व्याख्या (हिन्दी) 3^2=9>8, 4^2=16>8, 5^2=25>8. आउटपुट: 3 4 5.
128
EN + हिं
GB What is the output: int a[]={0,1,0,1,1,0}; cout<
IN आउटपुट क्या है: int a[]={0,1,0,1,1,0}; अदालत
A
3 3
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Three 1s. Output: 3.
व्याख्या (हिन्दी) तीन 1s. आउटपुट: 3.
129
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int b[]={5,4,3,2,1}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int b[]={5,4,3,2,1}; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Not equal. Output: 0.
व्याख्या (हिन्दी) सम नही। आउटपुट: 0.
130
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; v.assign(3,9); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; v.असाइन(3,9); अदालत
A
39 39
B
59 59
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Replaces with 3 copies of 9. size=3, v[0]=9. Output: 39.
व्याख्या (हिन्दी) 9 की 3 प्रतियों से प्रतिस्थापित। आकार=3, v[0]=9। आउटपुट: 39.
131
EN + हिं
GB What is the output: int a[]={2,4,8,16,32}; cout<
IN आउटपुट क्या है: int a[]={2,4,8,16,32}; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All pairs are doubling. adjacent_find returns end=a+5. Distance=5. Output: 5.
व्याख्या (हिन्दी) सभी जोड़े दोगुने हो रहे हैं। आसन्न_खोज अंत=ए+5 लौटाता है। दूरी=5. आउटपुट: 5.
132
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int s=transform_reduce(a,a+5,0,plus<>(),[](int x){return x%2;});cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int s=transform_reduce(a,a+5,0,plus(),[](int x){return x%2;});cout
A
3 3
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Odd elements: 1,3,5 contribute 1 each; evens 0. Sum=3. Output: 3.
व्याख्या (हिन्दी) विषम तत्व: 1,3,5 प्रत्येक 1 का योगदान करते हैं; समताएँ 0. योग=3. आउटपुट: 3.
133
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; stable_partition(v.begin(),v.end(),[](int x){return x%2==0;}); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; स्थिर_विभाजन(v.begin(),v.end(),[](int x){वापसी x%2==0;}); अदालत
A
25 25
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Evens first: {2,4,1,3,5}. v[0]=2,v[4]=5. Output: 25.
व्याख्या (हिन्दी) पहले सम: {2,4,1,3,5}। v[0]=2,v[4]=5. आउटपुट: 25.
134
EN + हिं
GB What is the output: int a[]={3,3,3,3,3}; cout<<*min_element(a,a+5)<<*max_element(a,a+5);
IN आउटपुट क्या है: int a[]={3,3,3,3,3}; अदालत
A
33 33
B
3 3 3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All 3. min=3,max=3. Output: 33.
व्याख्या (हिन्दी) सभी 3. न्यूनतम=3,अधिकतम=3. आउटपुट: 33.
135
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; rotate(v.begin(),v.end()-1,v.end()); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; रोटेट(v.begin(),v.end()-1,v.end()); अदालत
A
51 51
B
45 45
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After rotate: v[0]=5,v[4]=4. Output: 54.
व्याख्या (हिन्दी) घुमाने के बाद: v[0]=5,v[4]=4. आउटपुट: 54.
121–135 of 140