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
91
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int n=remove_if(a,a+5,[](int x){return x%2==0;})-a; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int n=remove_if(a,a+5,[](int x){return x%2==0;})-a; अदालत
A
3 3
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Removes 2,4. Remaining: 1,3,5 = 3. Output: 3.
व्याख्या (हिन्दी) 2,4 को हटाता है। शेष: 1,3,5 = 3. आउटपुट: 3.
92
EN + हिं
GB What is the output: int a[]={5,3,8,1,4}; make_heap(a,a+5); cout<
IN आउटपुट क्या है: int a[]={5,3,8,1,4}; मेक_हीप(ए,ए+5); अदालत
A
8 8
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max-heap: a[0]=8. Output: 8.
व्याख्या (हिन्दी) अधिकतम-ढेर: a[0]=8. आउटपुट: 8.
93
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; for_each_n(a,3,[](int& x){x*=2;}); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; for_each_n(a,3,[](int& x){x*=2;}); अदालत
A
2 4 6 4 2 4 6 4
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
option_b विकल्प_बी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) See explanation.
व्याख्या (हिन्दी) स्पष्टीकरण देखें.
94
EN + हिं
GB What is the output: vector v={1,2,3}; auto w=v; reverse(w.begin(),w.end()); cout<<(v==w);
IN आउटपुट क्या है: वेक्टर v={1,2,3}; ऑटो w=v; रिवर्स(w.begin(),w.end()); अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v={1,2,3} != {3,2,1}. Output: 0.
व्याख्या (हिन्दी) v={1,2,3} != {3,2,1}. आउटपुट: 0.
95
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<<*(max_element(a,a+5)-1);
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
4 4
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max is at a+4=&a[4]. a+4-1=&a[3]=4. Output: 4.
व्याख्या (हिन्दी) अधिकतम a+4=&a[4] पर है। a+4-1=&a[3]=4. आउटपुट: 4.
96
EN + हिं
GB What is the output: int a[10]={0}; fill_n(begin(a),5,1); cout<
IN आउटपुट क्या है: int a[10]={0}; fill_n(शुरू(ए),5,1); अदालत
A
55 55
B
50 50
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5 ones, 5 zeros. Output: 55.
व्याख्या (हिन्दी) 5 एक, 5 शून्य. आउटपुट: 55.
97
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; v.erase(v.begin(),v.begin()+2); cout<
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; v.erase(v.begin(),v.begin()+2); अदालत
A
33 33
B
13 13
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After erase: {3,4,5}. v[0]=3, size=3. Output: 33.
व्याख्या (हिन्दी) मिटाने के बाद: {3,4,5}। v[0]=3, आकार=3. आउटपुट: 33.
98
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) reduce with no init sums: 1+2+3+4+5=15. Output: 15.
व्याख्या (हिन्दी) बिना किसी प्रारंभिक योग के कम करें: 1+2+3+4+5=15। आउटपुट: 15.
99
EN + हिं
GB What is the output: int a[5]={0}; transform(a,a+5,a,[n=1](int)mutable{return n++;});for(int x:a) cout<
IN आउटपुट क्या है: int a[5]={0}; ट्रांसफॉर्म(ए,ए+5,ए,[एन=1](इंट)म्यूटेबल{रिटर्न एन++;});फॉर(इंट एक्स:ए) कॉउट
A
12345 12345
B
00000 00000
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) n increments: 1,2,3,4,5. Output: 12345.
व्याख्या (हिन्दी) n वेतन वृद्धि: 1,2,3,4,5. आउटपुट: 12345.
100
EN + हिं
GB What is 'std::views::as_rvalue' (C++23)?
IN 'std::views::as_rvalue' (C++23) क्या है?
A
Creates a view that moves elements instead of copying एक ऐसा दृश्य बनाता है जो तत्वों को कॉपी करने के बजाय स्थानांतरित करता है
B
Same as move चाल के समान
C
A sort view एक प्रकार का दृश्य
D
A filter एक फ़िल्टर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) as_rvalue wraps a range so elements are move-yielded; useful for moving from containers.
व्याख्या (हिन्दी) as_rvalue एक श्रेणी को लपेटता है ताकि तत्व स्थानांतरित-उपजित हों; कंटेनरों से ले जाने के लिए उपयोगी।
101
EN + हिं
GB What is the output: array a; iota(a.begin(),a.end(),1); cout<{});
IN आउटपुट क्या है: array a; iota(a.begin(),a.end(),1); अदालत
A
15 15
B
1 1
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.
102
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Addition is commutative; still 15. Output: 15.
व्याख्या (हिन्दी) जोड़ क्रमविनिमेय है; अभी भी 15. आउटपुट: 15.
103
EN + हिं
GB What is the output: vector v={2,4,6,8,10}; transform(v.begin(),v.end(),v.begin(),[](int x){return x/2;}); cout<
IN आउटपुट क्या है: वेक्टर v={2,4,6,8,10}; ट्रांसफ़ॉर्म(v.begin(),v.end(),v.begin(),[](int x){रिटर्न x/2;}); अदालत
A
15 15
B
51 51
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) v={1,2,3,4,5}. v[0]=1,v[4]=5. Output: 15.
व्याख्या (हिन्दी) v={1,2,3,4,5}. v[0]=1,v[4]=5. आउटपुट: 15.
104
EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; bool r=is_partitioned(a,a+5,[](int x){return x>2;}); cout<
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; bool r=is_partitioned(a,a+5,[](int x){return x>2;}); अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Partition by >2: {3,4,5} should come before {1,1}. But 3>2 then 1 not >2 then 4>2: NOT partitioned. Output: 0.
व्याख्या (हिन्दी) >2 द्वारा विभाजन: {3,4,5} {1,1} से पहले आना चाहिए। लेकिन 3>2 फिर 1 नहीं >2 फिर 4>2: विभाजित नहीं। आउटपुट: 0.
105
EN + हिं
GB What is the output: int a[]={5,3,1,4,2}; sort(a,a+5); cout<
IN आउटपुट क्या है: int a[]={5,3,1,4,2}; क्रमबद्ध करें(ए,ए+5); अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted; 3 exists. Output: 1.
व्याख्या (हिन्दी) क्रमबद्ध; 3 मौजूद है. आउटपुट: 1.
91–105 of 140