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
1321
EN + हिं
GB What is the output: int a=1,b=2,c=3; int *arr[3]={&c,&b,&a}; cout<<*arr[0]+*arr[2];
IN आउटपुट क्या है: int a=1,b=2,c=3; int *arr[3]={&c,&b,&a}; अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *arr[0]=3, *arr[2]=1. 3+1=4. Output: 4.
व्याख्या (हिन्दी) *arr[0]=3, *arr[2]=1. 3+1=4. आउटपुट: 4.
1322
EN + हिं
GB What is the output: struct A{int x=5; int* p=&x;}; A a; cout<<*(a.p);
IN आउटपुट क्या है: struct A{int x=5; int* p=&x;}; ए ए; अदालत
A
5 5
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a.p=&a.x; *(a.p)=5. Output: 5.
व्याख्या (हिन्दी) a.p=&a.x; *(ए.पी.)=5. आउटपुट: 5.
1323
EN + हिं
GB What is the output: int x=10; int *p=&x; auto q=p; *q=20; cout<
IN आउटपुट क्या है: int x=10; int *p=&x; ऑटो क्यू=पी; *क्यू=20; अदालत
A
20 20
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) q is int*; *q=20 changes x. Output: 20.
व्याख्या (हिन्दी) q int* है; *q=20 परिवर्तन x. आउटपुट: 20.
1324
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a; int *q=a+5; cout<<(q-p)<<*(q-1);
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a; int *q=a+5; अदालत
A
55 55
B
5 5 5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) q-p=5; *(q-1)=a[4]=5. Output: 55.
व्याख्या (हिन्दी) क्यू-पी=5; *(q-1)=a[4]=5. आउटपुट: 55.
1325
EN + हिं
GB What is the output: shared_ptr p; cout<<(bool)p<<' '; p=make_shared(5); cout<<(bool)p;
IN आउटपुट क्या है: share_ptr p; अदालत
A
0 1 0 1
B
1 1 11
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Empty=false=0; filled=true=1. Output: 0 1.
व्याख्या (हिन्दी) ख़ाली=झूठा=0; भरा=सत्य=1. आउटपुट: 0 1.
1326
EN + हिं
GB What is the output: int x=5; int *p=&x; *p=*p*2; cout<
IN आउटपुट क्या है: int x=5; int *p=&x; *पी=*पी*2; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=5*2=10; x=10. Output: 10.
व्याख्या (हिन्दी) *पी=5*2=10; एक्स=10. आउटपुट: 10.
1327
EN + हिं
GB What is the output: int a[]={10,20,30}; auto [x,y,z]=a; cout<
IN आउटपुट क्या है: int a[]={10,20,30}; ऑटो [x,y,z]=a; अदालत
A
102030 102030
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
321 321
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x=10,y=20,z=30. Output: 102030.
व्याख्या (हिन्दी) x=10,y=20,z=30. आउटपुट: 102030.
1328
EN + हिं
GB What is the output: int x=5; weak_ptr w; {auto s=make_shared(x); w=s;} cout<
IN आउटपुट क्या है: int x=5; कमजोर_पीटीआर डब्ल्यू; {ऑटो s=make_shared(x); w=s;} cout
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) s destroyed; w.expired()=true=1. Output: 1.
व्याख्या (हिन्दी) नष्ट हो गया; w.समाप्त()=सत्य=1. आउटपुट: 1.
1329
EN + हिं
GB What is the output: int a[]={1,2,3}; int *p=end(a); while(p!=begin(a)) cout<<*( (1, 6, 77, 7, 4, 'What is the output: auto del=[](int *p){delete p; cout<<'D';}; unique_ptr p(new int(5),del); cout<<*p;
IN आउटपुट क्या है: int a[]={1,2,3}; int *p=end(a); while(p!=begin(a)) cout
A
5D 5D
B
D5 डी5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=5; at destruction: D. Output: 5D.
व्याख्या (हिन्दी) *पी=5; विनाश पर: डी. आउटपुट: 5डी.
1330
EN + हिं
GB What is the output: auto del=[](int *p){delete p; cout<<'D';}; unique_ptr p(new int(5),del); cout<<*p;
IN आउटपुट क्या है: auto del=[](int *p){delete p; अदालत
A
5D 5D
B
D5 डी5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=5; at destruction: D. Output: 5D.
व्याख्या (हिन्दी) *पी=5; विनाश पर: डी. आउटपुट: 5डी.
1331
EN + हिं
GB What is the output: int x=5,y=10; int* arr[]={&x,&y}; *arr[0]+=*arr[1]; cout<
IN आउटपुट क्या है: int x=5,y=10; int* arr[]={&x,&y}; *arr[0]+=*arr[1]; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *arr[0]=x+=y=10: x=15. Output: 15.
व्याख्या (हिन्दी) *arr[0]=x+=y=10: x=15. आउटपुट: 15.
1332
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; sort(a,a+5,[](int a,int b){return a>b;}); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; sort(a,a+5,[](int a,int b){return a>b;}); अदालत
A
51 51
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Desc: 5,4,3,2,1. a[0]=5,a[4]=1. Output: 51.
व्याख्या (हिन्दी) विवरण: 5,4,3,2,1. ए[0]=5,ए[4]=1. आउटपुट: 51.
1333
EN + हिं
GB What is the output: int x=42; const int* p=&x; cout<<*p;
IN आउटपुट क्या है: int x=42; स्थिरांक int* p=&x; अदालत
A
42 42
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p reads x=42. Output: 42.
व्याख्या (हिन्दी) *p x=42 पढ़ता है। आउटपुट: 42.
1334
EN + हिं
GB What is the output: int a[3]={1,2,3}; auto f=[](auto *p,int n){return accumulate(p,p+n,0);}; cout<
IN आउटपुट क्या है: int a[3]={1,2,3}; ऑटो f=[](ऑटो *पी,इंट एन){रिटर्न एक्युमेटेड(पी,पी+एन,0);}; अदालत
A
6 6
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+2+3=6. Output: 6.
व्याख्या (हिन्दी) 1+2+3=6. आउटपुट: 6.
1335
EN + हिं
GB What is the output: int* f(int n){return new int(n*n);} auto p=unique_ptr(f(5)); cout<<*p;
IN आउटपुट क्या है: int* f(int n){return new int(n*n);} auto p=unique_ptr(f(5)); अदालत
A
25 25
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) f(5)=new int(25). *p=25. Output: 25.
व्याख्या (हिन्दी) f(5)=नया int(25). *पी=25. आउटपुट: 25.
1321–1335 of 1915