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
736
EN + हिं
GB What is the output: int a[5]={1,2,3,4,5}; copy_if(a,a+5,ostream_iterator(cout),[](int x){return x%2!=0;});
IN आउटपुट क्या है: int a[5]={1,2,3,4,5}; Copy_if(a,a+5,ostream_iterator(cout),[](int x){return x%2!=0;});
A
135 135
B
24 24
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Copies 1,3,5. Output: 135.
व्याख्या (हिन्दी) प्रतिलिपियाँ 1,3,5. आउटपुट: 135.
737
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; cout<<*max_element(v.begin(),v.end());
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; अदालत
A
5 5
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=5. Output: 5.
व्याख्या (हिन्दी) अधिकतम=5. आउटपुट: 5.
738
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) Comparing array to itself: all equal. Output: 1.
व्याख्या (हिन्दी) सरणी की स्वयं से तुलना करना: सभी समान। आउटपुट: 1.
739
EN + हिं
GB What is the output: int a[]={1,2,3}; int b[]={1,2,3}; cout<
IN आउटपुट क्या है: int a[]={1,2,3}; int b[]={1,2,3}; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All elements equal. Output: 1.
व्याख्या (हिन्दी) सभी तत्व समान हैं. आउटपुट: 1.
740
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) a[0]=1 vs a[1]=2: mismatch at first element. first=a. distance=0. Output: 0.
व्याख्या (हिन्दी) a[0]=1 बनाम a[1]=2: पहले तत्व पर बेमेल। प्रथम=ए. दूरी=0. आउटपुट: 0.
741
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; adjacent_difference(a,a+5,a); for(int x:a) cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; आसन्न_अंतर(ए,ए+5,ए); for(int x:a) कोउट
A
11111 11111
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1,2-1=1,3-2=1,4-3=1,5-4=1. Output: 11111.
व्याख्या (हिन्दी) 1,2-1=1,3-2=1,4-3=1,5-4=1. आउटपुट: 11111.
742
EN + हिं
GB What is the output: int a[5]={0}; generate_n(a,5,[n=1]()mutable{return n++;});cout<
IN आउटपुट क्या है: int a[5]={0}; generate_n(a,5,[n=1]()mutable{return n++;});cout
A
5 5
B
4 4
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a={1,2,3,4,5}. a[4]=5. Output: 5.
व्याख्या (हिन्दी) ए={1,2,3,4,5}। ए[4]=5. आउटपुट: 5.
743
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; rotate(v.begin(),v.begin()+3,v.end()); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; रोटेट(v.begin(),v.begin()+3,v.end()); अदालत
A
41 41
B
14 14
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After rotate: {4,5,1,2,3}. v[0]=4,v[4]=3. Output: 43.
व्याख्या (हिन्दी) घुमाने के बाद: {4,5,1,2,3}। v[0]=4,v[4]=3. आउटपुट: 43.
744
EN + हिं
GB What is the output: int a[]={1,2,3,4,5,4,3,2,1}; sort(a,a+9); cout<<*upper_bound(a,a+9,3);
IN आउटपुट क्या है: int a[]={1,2,3,4,5,4,3,2,1}; क्रमबद्ध करें(ए,ए+9); अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,1,2,2,3,3,4,4,5. upper_bound(3) points to first 4. Output: 4.
व्याख्या (हिन्दी) क्रमबद्ध: 1,1,2,2,3,3,4,4,5। अपर_बाउंड(3) पहले 4 की ओर इशारा करता है। आउटपुट: 4।
745
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<(),[](int x){return x*x;});
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
55 55
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+4+9+16+25=55. Output: 55.
व्याख्या (हिन्दी) 1+4+9+16+25=55. आउटपुट: 55.
746
EN + हिं
GB What is the output: int a[3][3]={{1,2,3},{4,5,6},{7,8,9}}; cout<
IN आउटपुट क्या है: int a[3][3]={{1,2,3},{4,5,6},{7,8,9}}; अदालत
A
10 10
B
11 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3+7=10. Output: 10.
व्याख्या (हिन्दी) 3+7=10. आउटपुट: 10.
747
EN + हिं
GB What is the output: int a[]={10,20,30}; cout<<*max_element(a,a+3)-*min_element(a,a+3);
IN आउटपुट क्या है: int a[]={10,20,30}; अदालत
A
20 20
B
30 30
C
10 10
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 30-10=20. Output: 20.
व्याख्या (हिन्दी) 30-10=20. आउटपुट: 20.
748
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<(),minus<>());
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Each element minus itself=0; sum=0. Output: 0.
व्याख्या (हिन्दी) प्रत्येक तत्व शून्य से स्वयं=0; योग=0. आउटपुट: 0.
749
EN + हिं
GB What is the output: int a[]={5,3,8,1,4}; partial_sort(a,a+3,a+5); cout<
IN आउटपुट क्या है: int a[]={5,3,8,1,4}; आंशिक_सॉर्ट(ए,ए+3,ए+5); अदालत
A
138 138
B
345 345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3 smallest in sorted order: 1,3,4. Output: 134.
व्याख्या (हिन्दी) क्रमबद्ध क्रम में 3 सबसे छोटे: 1,3,4. आउटपुट: 134.
750
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; cout<());
IN आउटपुट क्या है: वेक्टर v={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.
736–750 of 1915