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
121
EN + हिं
GB What is the output: int a[]={5,4,3,2,1}; auto f=[](int *b,int *e){while(b
IN आउटपुट क्या है: int a[]={5,4,3,2,1}; ऑटो f=[](int *b,int *e){जबकि(b
A
54321 54321
B
12345 12345
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Prints 5,4,3,2,1. Output: 54321.
व्याख्या (हिन्दी) 5,4,3,2,1 प्रिंट करता है। आउटपुट: 54321.
122
EN + हिं
GB What is the output: int x=42; auto wp=weak_ptr{}; {auto sp=make_shared(x); wp=sp; cout<<*wp.lock()<<' ';} cout<
IN आउटपुट क्या है: int x=42; ऑटो wp=weak_ptr{}; {ऑटो एसपी=मेक_शेयर्ड(x); wp=sp; अदालत
A
42 1 42 1
B
42 0 42 0
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Inside block: lock=42. After block: expired=1. Output: 42 1.
व्याख्या (हिन्दी) अंदर का ब्लॉक: लॉक=42. ब्लॉक के बाद: समाप्त=1. आउटपुट: 42 1.
123
EN + हिं
GB What is the output: int a[3]={1,2,3}; int *p=a+3; cout<<(p==end(a));
IN आउटपुट क्या है: int a[3]={1,2,3}; int *p=a+3; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a+3==end(a)=true=1. Output: 1.
व्याख्या (हिन्दी) ए+3==अंत(ए)=सत्य=1. आउटपुट: 1.
124
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int* mid=a+2; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int* मध्य=ए+2; अदालत
A
12345 12345
B
34512 34512
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) mid=a+2. mid[-2]=1,mid[-1]=2,mid[0]=3,mid[1]=4,mid[2]=5. Output: 12345.
व्याख्या (हिन्दी) मध्य=ए+2. मध्य[-2]=1,मध्य[-1]=2,मध्य[0]=3,मध्य[1]=4,मध्य[2]=5. आउटपुट: 12345.
125
EN + हिं
GB What is the output: int x=0; auto p=&x; for(int i=0;i<5;++i) ++*p; cout<
IN आउटपुट क्या है: int x=0; ऑटो पी=&x; for(int i=0;i
A
5 5
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p is x; incremented 5 times. Output: 5.
व्याख्या (हिन्दी) *पी एक्स है; 5 गुना वृद्धि. आउटपुट: 5.
126
EN + हिं
GB What is the output: struct P{int x,y;}; P a{3,4}; P *p=&a; cout<x*p->x+p->y*p->y;
IN आउटपुट क्या है: struct P{int x,y;}; पी ए{3,4}; पी *पी=&ए; coutx+p->y*p->y;
A
25 25
B
7 7
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 9+16=25. Output: 25.
व्याख्या (हिन्दी) 9+16=25. आउटपुट: 25.
127
EN + हिं
GB What is the output: int a[]={2,4,6,8,10}; for(auto *p=rbegin(a);p!=rend(a);++p) cout<<*p;
IN आउटपुट क्या है: int a[]={2,4,6,8,10}; for(auto *p=rbegin(a);p!=rend(a);++p) cout
A
10 8 6 4 2 10 8 6 4 2
B
108642 108642
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Outputs 10,8,6,4,2. Output: 108642.
व्याख्या (हिन्दी) आउटपुट 10,8,6,4,2. आउटपुट: 108642.
121–127 of 127