OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 127 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
127 questions
61
EN + हिं
GB What is the output: int x=5; int *p=&x; cout<(p)%4;
IN आउटपुट क्या है: int x=5; int *p=&x; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Int is typically 4-byte aligned; address divisible by 4. Output: 0.
व्याख्या (हिन्दी) Int आमतौर पर 4-बाइट संरेखित होता है; पता 4 से विभाज्य है। आउटपुट: 0.
62
EN + हिं
GB What is the output: int a[]={1,2,3}; int *p=a; cout<
IN आउटपुट क्या है: int a[]={1,2,3}; int *p=a; अदालत
A
123 123
B
321 321
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[0]=1,p[1]=2,p[2]=3. Output: 123.
व्याख्या (हिन्दी) पी[0]=1,पी[1]=2,पी[2]=3. आउटपुट: 123.
63
EN + हिं
GB What is the output: int x=10; int &r=x; int *p=&r; ++(*p); cout<
IN आउटपुट क्या है: int x=10; int &r=x; int *p=&r; ++(*p); अदालत
A
11 11
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &r=&x. ++(*p)=++x=11. r=11. Output: 11.
व्याख्या (हिन्दी) &r=&x. ++(*p)=++x=11. आर=11. आउटपुट: 11.
64
EN + हिं
GB What is the output: int a[]={2,4,6,8}; int *p=a+1; cout<
IN आउटपुट क्या है: int a[]={2,4,6,8}; int *p=a+1; अदालत
A
246 246
B
468 468
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[-1]=a[0]=2,p[0]=a[1]=4,p[1]=a[2]=6. Output: 246.
व्याख्या (हिन्दी) p[-1]=a[0]=2,p[0]=a[1]=4,p[1]=a[2]=6. आउटपुट: 246.
65
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.
66
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.
67
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.
68
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.
69
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.
70
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.
71
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.
72
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.
73
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.
74
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.
75
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डी.
61–75 of 127