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
1336
EN + हिं
GB What is the output: int a[]={5,4,3,2,1}; int *p=max_element(a,a+5); cout<<*p<<(p-a);
IN आउटपुट क्या है: int a[]={5,4,3,2,1}; int *p=max_element(a,a+5); अदालत
A
50 50
B
05 05
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=5 at index 0. Output: 50.
व्याख्या (हिन्दी) सूचकांक 0 पर अधिकतम=5। आउटपुट: 50।
1337
EN + हिं
GB What is the output: int x=10; int *p=&x; int *q=&x; cout<<(*p=20,*q);
IN आउटपुट क्या है: int x=10; int *p=&x; int *q=&x; अदालत
A
20 20
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=20 sets x=20; comma; *q=x=20. Output: 20.
व्याख्या (हिन्दी) *पी=20 सेट x=20; अल्पविराम; *q=x=20. आउटपुट: 20.
1338
EN + हिं
GB What is the output: shared_ptr a=make_shared(1); auto b=a; auto c=a; cout<
IN आउटपुट क्या है: share_ptr a=make_shared(1); ऑटो बी=ए; ऑटो सी=ए; अदालत
A
3 3
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a,b,c all own. use_count=3. Output: 3.
व्याख्या (हिन्दी) ए,बी,सी सब अपने। उपयोग_गिनती=3. आउटपुट: 3.
1339
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a; advance(p,2); cout<<*p<<' '<<*(p+1);
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a; अग्रिम(पी,2); अदालत
A
3 4 3 4
B
1 2 1 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p=&a[2]=3; p+1=&a[3]=4. Output: 3 4.
व्याख्या (हिन्दी) पी=&ए[2]=3; पी+1=&ए[3]=4. आउटपुट: 3 4.
1340
EN + हिं
GB What is the output: int x=5; auto f=[p=&x](int v){*p+=v;}; f(10); cout<
IN आउटपुट क्या है: int x=5; ऑटो f=[p=&x](int v){*p+=v;}; च(10); अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p=&x; *p+=10=x=15. Output: 15.
व्याख्या (हिन्दी) p=&x; *p+=10=x=15. आउटपुट: 15.
1341
EN + हिं
GB What is the output: unique_ptr p=make_unique(5); iota(p.get(),p.get()+5,1); cout<
IN आउटपुट क्या है:unique_ptr p=make_unique(5); iota(p.get(),p.get()+5,1); अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p={1,2,3,4,5}. p[4]=5. Output: 5.
व्याख्या (हिन्दी) पी={1,2,3,4,5}। पी[4]=5. आउटपुट: 5.
1342
EN + हिं
GB What is the output: int a[]={1,2,3}; cout<
IN आउटपुट क्या है: int a[]={1,2,3}; अदालत
A
123 123
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0*10+1=1; 1*10+2=12; 12*10+3=123. Output: 123.
व्याख्या (हिन्दी) 0*10+1=1; 1*10+2=12; 12*10+3=123. आउटपुट: 123.
1343
EN + हिं
GB What is the output: int x=5; auto sp=make_shared(x); auto wp=weak_ptr(sp); if(auto lp=wp.lock()) cout<<*lp;
IN आउटपुट क्या है: int x=5; ऑटो एसपी=make_shared(x); ऑटो wp=weak_ptr(sp); if(auto lp=wp.lock()) cout
A
5 5
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Nothing कुछ नहीं
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) lock() succeeds; *lp=5. Output: 5.
व्याख्या (हिन्दी) लॉक() सफल होता है; *एलपी=5. आउटपुट: 5.
1344
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *b=new int[5]; copy(a,a+5,b); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *b=new int[5]; कॉपी(ए,ए+5,बी); अदालत
A
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b={1,2,3,4,5}. b[2]=3. Output: 3.
व्याख्या (हिन्दी) बी={1,2,3,4,5}। बी[2]=3. आउटपुट: 3.
1345
EN + हिं
GB What is the output: int x=5,y=10,z=15; int *ptrs[]={&x,&y,&z}; int s=0; for(auto p:ptrs) s+=*p; cout<
IN आउटपुट क्या है: int x=5,y=10,z=15; int *ptrs[]={&x,&y,&z}; int s=0; for(auto p:ptrs) s+=*p; अदालत
A
30 30
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5+10+15=30. Output: 30.
व्याख्या (हिन्दी) 5+10+15=30. आउटपुट: 30.
1346
EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; nth_element(a,a+2,a+5); cout<
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; nth_element(a,a+2,a+5); अदालत
A
3 3
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,1,3,4,5. 3rd=3. Output: 3.
व्याख्या (हिन्दी) क्रमबद्ध: 1,1,3,4,5. 3=3. आउटपुट: 3.
1347
EN + हिं
GB What is the output: struct Node{int v; shared_ptr next;}; auto a=make_shared(Node{1,nullptr}); auto b=make_shared(Node{2,a}); cout<next->v;
IN What is the output: struct Node{int v; share_ptr अगला;}; auto a=make_shared(Node{1,nullptr}); auto b=make_shared(Node{2,a}); coutv;
A
1 1
B
2 2
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b->next=a; a->v=1. Output: 1.
व्याख्या (हिन्दी) बी->अगला=ए; a->v=1. आउटपुट: 1.
1348
EN + हिं
GB What is the output: int a[]={1,2,3}; int *p=a; cout<<(*p++)<<(*p++);
IN आउटपुट क्या है: int a[]={1,2,3}; int *p=a; अदालत
A
12 12
B
23 23
C
Undefined अपरिभाषित
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) C++17: left-to-right evaluation of <<. First *p++=1(p=a+1); then *p++=2(p=a+2). Output: 12.
व्याख्या (हिन्दी) C++17: बाएँ से दाएँ मूल्यांकन
1349
EN + हिं
GB What is the output: class A{public:int x; A(int v):x(v){} A operator*(const A& o){return {x*o.x};}}; A a(3),b(4); cout<<(a*b).x;
IN आउटपुट क्या है: class A{public:int x; A(int v):x(v){} A ऑपरेटर*(const A& o){return {x*o.x};}}; ए ए(3),बी(4); अदालत
A
12 12
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3*4=12. Output: 12.
व्याख्या (हिन्दी) 3*4=12. आउटपुट: 12.
1350
EN + हिं
GB What is the output: class A{int x=0; public: auto& ref(){return x;}}; A a; a.ref()=42; cout<
IN आउटपुट क्या है: class A{int x=0; सार्वजनिक: ऑटो&रेफ(){रिटर्न x;}}; ए ए; a.ref()=42; अदालत
A
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a.ref()=42 sets x=42. a.ref()=42. Output: 42.
व्याख्या (हिन्दी) a.ref()=42 सेट x=42। a.ref()=42. आउटपुट: 42.
1336–1350 of 1915