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
46
EN + हिं
GB 'What is the output: int a[]={5,4,3,2,1}; int *p=a,*q=a+4; while(p
IN 'आउटपुट क्या है: int a[]={5,4,3,2,1}; int *p=a,*q=a+4; जबकि(पी
A
4}; cout<<p->x+p->y; delete p;', 'struct pointer: p->x+p->y?', '7', '7', '12', '12', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', '3+4=7. Output: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: int a[]={10 4}; कॉउटी; हटाएँ p;', 'संरचना सूचक: p->x+p->y?', '7', '7', '12', '12', 'संकलन त्रुटि', 'संकलन त्रुटि', 'अपरिभाषित', 'अपरिभाषित', NULL, 'option_a', '3+4=7। आउटपुट: 7.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'आउटपुट क्या है: int a[]={10
B
30}; int *const p=a; p[1]=200; cout<<a[1];', 'const pointer (not const int): modify via []?', '200', '200', '20', '20', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', 'p is const pointer; *data* can be modified. p[1]=200 sets a[1]=200. Output: 200.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: int x=5; unique_ptr<int> p=make_unique<int>(x); unique_ptr<int> q=move(p); cout<<(bool)p<<*q;', 'Move unique_ptr: p null 30}; int *const p=a; पी[1]=200; अदालत
C
*q=5. Output: 05.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: int a[]={1 *क्यू=5. आउटपुट: 05.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'आउटपुट क्या है: int a[]={1
D
3 3
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) &y}; *p[0]+=*p[1]; cout<>(3,0); (*sp)[1]=5; cout<<(*sp)[1];', 'shared_ptr to vector?', '5', '5', '0', '0', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', '(*sp)[1]=5. Output: 5.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: int a[]={3
व्याख्या (हिन्दी) &y}; *पी[0]+=*पी[1]; अदालत
47
EN + हिं
GB What is the output: struct P{int x,y;}; P* p=new P{3,4}; cout<x+p->y; delete p;
IN आउटपुट क्या है: struct P{int x,y;}; पी* पी=नया पी{3,4}; कॉउटी; पी हटाएं;
A
7 7
B
12 12
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3+4=7. Output: 7.
व्याख्या (हिन्दी) 3+4=7. आउटपुट: 7.
48
EN + हिं
GB What is the output: int a[]={10,20,30}; int *const p=a; p[1]=200; cout<
IN आउटपुट क्या है: int a[]={10,20,30}; int *const p=a; पी[1]=200; अदालत
A
200 200
B
20 20
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p is const pointer; *data* can be modified. p[1]=200 sets a[1]=200. Output: 200.
व्याख्या (हिन्दी) पी स्थिरांक सूचक है; *डेटा* को संशोधित किया जा सकता है। p[1]=200 सेट a[1]=200। आउटपुट: 200.
49
EN + हिं
GB What is the output: int x=5; unique_ptr p=make_unique(x); unique_ptr q=move(p); cout<<(bool)p<<*q;
IN आउटपुट क्या है: int x=5; अद्वितीय_ptr p=make_unique(x); अद्वितीय_पीटीआर क्यू=मूव(पी); अदालत
A
05 05
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After move: p=null(false=0), *q=5. Output: 05.
व्याख्या (हिन्दी) चाल के बाद: p=null(false=0), *q=5. आउटपुट: 05.
50
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<<*(a+sizeof(a)/sizeof(*a)-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) sizeof(a)/sizeof(*a)=5. a+4=&a[4]=5. Output: 5.
व्याख्या (हिन्दी) आकार(ए)/आकार(*ए)=5. ए+4=&ए[4]=5. आउटपुट: 5.
51
EN + हिं
GB What is the output: int x=5,y=10; int *p[2]={&x,&y}; *p[0]+=*p[1]; cout<
IN आउटपुट क्या है: int x=5,y=10; int *p[2]={&x,&y}; *पी[0]+=*पी[1]; अदालत
A
15 15
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p[0]=x+=y=10: x=15. Output: 15.
व्याख्या (हिन्दी) *p[0]=x+=y=10: x=15. आउटपुट: 15.
52
EN + हिं
GB What is the output: auto sp=make_shared>(3,0); (*sp)[1]=5; cout<<(*sp)[1];
IN आउटपुट क्या है: auto sp=make_shared(3,0); (*एसपी)[1]=5; अदालत
A
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (*sp)[1]=5. Output: 5.
व्याख्या (हिन्दी) (*एसपी)[1]=5. आउटपुट: 5.
53
EN + हिं
GB What is the output: int a[]={3,1,4,1,5}; int *p=max_element(a,a+5); cout<<*p<<(p-a);
IN आउटपुट क्या है: int a[]={3,1,4,1,5}; int *p=max_element(a,a+5); अदालत
A
54 54
B
45 45
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=5 at index 4. Output: 54.
व्याख्या (हिन्दी) सूचकांक 4 पर अधिकतम=5। आउटपुट: 54।
54
EN + हिं
GB What is the output: char s[]="Hello"; for(char *p=s;*p;p++) *p=toupper(*p); cout<
IN आउटपुट क्या है: char s[]='हैलो'; for(char *p=s;*p;p++) *p=toupper(*p); अदालत
A
HELLO नमस्ते
B
Hello नमस्ते
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) toupper each char. Output: HELLO.
व्याख्या (हिन्दी) प्रत्येक चार को टॉपर करें। आउटपुट: नमस्ते.
55
EN + हिं
GB What is the output: int x=42; int *p=&x; void *vp=p; int *p2=static_cast(vp); cout<<*p2;
IN आउटपुट क्या है: int x=42; int *p=&x; शून्य *vp=p; int *p2=static_cast(vp); अदालत
A
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) static_cast back to int*. *p2=42. Output: 42.
व्याख्या (हिन्दी) static_cast वापस int* पर। *पी2=42. आउटपुट: 42.
56
EN + हिं
GB What is the output: int a[3]={1,2,3}; auto f=[](int *p,int n){int s=0;for(int i=0;i
IN आउटपुट क्या है: int a[3]={1,2,3}; ऑटो f=[](int *p,int n){int s=0;for(int i=0;i
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.
57
EN + हिं
GB What is the output: int *p=new int[5]; for(int i=0;i<5;i++) p[i]=i*i; cout<
IN आउटपुट क्या है: int *p=new int[5]; for(int i=0;i
A
9 9
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[3]=9. Output: 9.
व्याख्या (हिन्दी) पी[3]=9. आउटपुट: 9.
58
EN + हिं
GB What is the output: int x=5; shared_ptr a,b; a=make_shared(x); b=a; a.reset(); cout<
IN आउटपुट क्या है: int x=5; साझा_पीटीआर ए,बी; a=make_shared(x); बी=ए; ए.रीसेट(); अदालत
A
15 15
B
05 05
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) After a.reset(): b owns the object. use_count=1, *b=5. Output: 15.
व्याख्या (हिन्दी) a.reset() के बाद: b ऑब्जेक्ट का स्वामी है। उपयोग_गिनती=1, *बी=5. आउटपुट: 15.
59
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *begin=a,*end=a+5; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *शुरू=ए,*अंत=ए+5; अदालत
A
15 15
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sum=15. Output: 15.
व्याख्या (हिन्दी) योग=15. आउटपुट: 15.
60
EN + हिं
GB What is the output: int x=10; auto* p=new auto(x); cout<<*p<<' '; delete p; cout<<(p=nullptr)==nullptr;
IN आउटपुट क्या है: int x=10; ऑटो* पी=नया ऑटो(x); अदालत
A
10 1 10 1
B
10 0 10 0
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=10; delete; p=nullptr; nullptr==nullptr=1. Output: 10 1.
व्याख्या (हिन्दी) *पी=10; मिटाना; p=nullptr; nullptr==nullptr=1. आउटपुट: 10 1.
46–60 of 127