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
76
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डी.
77
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.
78
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.
79
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.
80
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.
81
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.
82
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।
83
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.
84
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.
85
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.
86
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.
87
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.
88
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.
89
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.
90
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.
76–90 of 127