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
46
EN + हिं
GB What is the output: deque d; for(int i=1;i<=5;i++) d.push_front(i); cout<
IN आउटपुट क्या है: डेक डी; for(int i=1;i
A
51 51
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) d={5,4,3,2,1}. d[0]=5,d[4]=1. Output: 51.
व्याख्या (हिन्दी) d={5,4,3,2,1}. d[0]=5,d[4]=1. आउटपुट: 51.
47
EN + हिं
GB What is the output: int a[]={2,4,6,8,10}; cout<());
IN आउटपुट क्या है: int a[]={2,4,6,8,10}; अदालत
A
3840 3840
B
30 30
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 2*4*6*8*10=3840. Output: 3840.
व्याख्या (हिन्दी) 2*4*6*8*10=3840. आउटपुट: 3840.
48
EN + हिं
GB What is the output: int a[5]={1,2,3,4,5}; reverse_copy(a,a+5,ostream_iterator(cout));
IN आउटपुट क्या है: int a[5]={1,2,3,4,5}; रिवर्स_कॉपी(ए,ए+5,ओस्ट्रीम_इटरेटर(काउट));
A
54321 54321
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Copies reversed: 5,4,3,2,1. Output: 54321.
व्याख्या (हिन्दी) प्रतियाँ उलटी: 5,4,3,2,1. आउटपुट: 54321.
49
EN + हिं
GB What is 'std::mdspan' in C++23?
IN C++23 में 'std::mdspan' क्या है?
A
Multi-dimensional span for contiguous data सन्निहित डेटा के लिए बहुआयामी विस्तार
B
A 2D vector एक 2डी वेक्टर
C
A matrix class एक मैट्रिक्स वर्ग
D
A 3D array एक 3D सरणी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::mdspan provides a multi-dimensional view over contiguous data without owning it.
व्याख्या (हिन्दी) std::mdspan बिना स्वामित्व के सन्निहित डेटा पर एक बहुआयामी दृश्य प्रदान करता है।
50
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; auto it=find_if_not(a,a+5,[](int x){return x<4;}); cout<<*it;
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; स्वतः it=find_if_not(a,a+5,[](int x){return x
A
4 4
B
5 5
C
3 3
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) First element not <4 is 4. Output: 4.
व्याख्या (हिन्दी) पहला तत्व नहीं
51
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.
52
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.
53
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.
54
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.
55
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.
56
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.
57
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.
58
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.
59
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।
60
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.
46–60 of 140