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
1306
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.
1307
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.
1308
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.
1309
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.
1310
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.
1311
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 एक श्रेणी को लपेटता है ताकि तत्व स्थानांतरित-उपजित हों; कंटेनरों से ले जाने के लिए उपयोगी।
1312
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.
1313
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.
1314
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.
1315
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.
1316
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.
1317
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.
1318
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.
1319
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=&a[2]; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=&a[2]; अदालत
A
15 15
B
31 31
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[-2]=a[0]=1; p[2]=a[4]=5. Output: 15.
व्याख्या (हिन्दी) पी[-2]=ए[0]=1; पी[2]=ए[4]=5. आउटपुट: 15.
1320
EN + हिं
GB What is the output: int x=5; auto* p=new auto(x*2); cout<<*p; delete p;
IN आउटपुट क्या है: int x=5; ऑटो* पी=नया ऑटो(x*2); अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=10. Output: 10.
व्याख्या (हिन्दी) *पी=10. आउटपुट: 10.
1306–1320 of 1915