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
1636
EN + हिं
GB What is the output: vector v={1,2,3,4,5}; cout<{});
IN आउटपुट क्या है: वेक्टर v={1,2,3,4,5}; अदालत
A
120 120
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1*1*2*3*4*5=120. Output: 120.
व्याख्या (हिन्दी) 1*1*2*3*4*5=120. आउटपुट: 120.
1637
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a+2,*q=a; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a+2,*q=a; अदालत
A
21 21
B
23 23
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p-q=2. *(q+p-a-2)=*(a+2+a-a-2)=*(a+... wait: q=a,p=a+2. p-a=2. *(q+2-2)=*(a)=1. q+p-a-2=a+a+2-a-2=a. *a=1. Hmm: 21. But *(q+p-a-2): q=a(pointer), p=a+2(pointer). q+p would be adding two pointers = UB. Output: Undefined.
व्याख्या (हिन्दी) पी-क्यू=2. *(q+p-a-2)=*(a+2+a-a-2)=*(a+... रुकें: q=a,p=a+2. p-a=2. *(q+2-2)=*(a)=1. q+p-a-2=a+a+2-a-2=a. *a=1. हम्म: 21. लेकिन *(q+p-a-2): q=a(सूचक), p=a+2(सूचक)। q+p दो सूचक जोड़ देगा = यूबी।
1638
EN + हिं
GB What is the output: int x=5; int *p=&x; auto f=[p]()->int{return *p*2;}; cout<
IN आउटपुट क्या है: int x=5; int *p=&x; ऑटो f=[p]()->int{रिटर्न *p*2;}; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=5; 5*2=10. Output: 10.
व्याख्या (हिन्दी) *पी=5; 5*2=10. आउटपुट: 10.
1639
EN + हिं
GB What is the output: int a[]={1,2,3}; cout<<(*(a+0)+*(a+1)+*(a+2));
IN आउटपुट क्या है: int a[]={1,2,3}; अदालत
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.
1640
EN + हिं
GB What is the output: int x=5; int *p=&x; *p+=*p; cout<
IN आउटपुट क्या है: int x=5; int *p=&x; *पी+=*पी; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x+=x=10. Output: 10.
व्याख्या (हिन्दी) x+=x=10. आउटपुट: 10.
1641
EN + हिं
GB What is the output: int a[]={10,20,30}; for(int *p=a;p
IN आउटपुट क्या है: int a[]={10,20,30}; for(int *p=a;p
A
40 40
B
20 20
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[1]=20*2=40. Output: 40.
व्याख्या (हिन्दी) ए[1]=20*2=40. आउटपुट: 40.
1642
EN + हिं
GB What is the output: char s[]="hello"; for(char *p=s;*p;p++) if(*p=='l') *p='L'; cout<
IN आउटपुट क्या है: char s[]='हैलो'; for(char *p=s;*p;p++) if(*p=='l') *p='L'; अदालत
A
heLLo नमस्ते
B
hello नमस्ते
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Both l's replaced. Output: heLLo.
व्याख्या (हिन्दी) दोनों एल को बदल दिया गया। आउटपुट: हेलो.
1643
EN + हिं
GB What is the output: int a[]={5,3,8,1,4}; int *mx=a; for(int *p=a+1;p*mx) mx=p; cout<<*mx<<(mx-a);
IN आउटपुट क्या है: int a[]={5,3,8,1,4}; int *mx=a; for(int *p=a+1;p*mx) mx=p; अदालत
A
82 82
B
58 58
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) max=8 at index 2. Output: 82.
व्याख्या (हिन्दी) सूचकांक 2 पर अधिकतम=8। आउटपुट: 82।
1644
EN + हिं
GB What is the output: int x=5; const int* cp=&x; int* const pc=&x; *pc=10; cout<<*cp;
IN आउटपुट क्या है: int x=5; स्थिरांक int* cp=&x; int* const pc=&x; *पीसी=10; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *pc=10 changes x=10. cp reads x=10. Output: 10.
व्याख्या (हिन्दी) *पीसी=10 परिवर्तन x=10। सीपी x=10 पढ़ता है। आउटपुट: 10.
1645
EN + हिं
GB What is the output: auto p=make_unique>(3,4); cout<first+p->second;
IN आउटपुट क्या है: auto p=make_unique(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.
1646
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a; while(*p++!=3) {} cout<<*p;
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a; while(*p++!=3) {} cout
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p++=1(p=a+1),2,3(p=a+3). Now *p=a[3]=4. Output: 4.
व्याख्या (हिन्दी) *p++=1(p=a+1),2,3(p=a+3). अब *p=a[3]=4. आउटपुट: 4.
1647
EN + हिं
GB What is the output: int x=5; shared_ptr p=make_shared(); *p=x*2; cout<<*p;
IN आउटपुट क्या है: int x=5; share_ptr p=make_shared(); *पी=एक्स*2; अदालत
A
10 10
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=10. Output: 10.
व्याख्या (हिन्दी) *पी=10. आउटपुट: 10.
1648
EN + हिं
GB What is the output: int a[5]; int *p=a; for(int i=0;i<5;i++) *p++=i*i; cout<
IN आउटपुट क्या है: int a[5]; int *p=a; for(int i=0;i
A
9 9
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a[3]=3^2=9. Output: 9.
व्याख्या (हिन्दी) a[3]=3^2=9. आउटपुट: 9.
1649
EN + हिं
GB What is the output: string s="hello"; char *p=&s[0]; *(p+4)='!'; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; चार *p=&s[0]; *(पी+4)='!'; अदालत
A
hell! नरक!
B
hello नमस्ते
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) s[4]='!'. Output: hell!.
व्याख्या (हिन्दी) s[4]='!'. आउटपुट: नरक!
1650
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *b=new int[5]; copy(a,a+5,b); transform(b,b+5,b,[](int x){return x*x;}); cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *b=new int[5]; कॉपी(ए,ए+5,बी); परिवर्तन(बी,बी+5,बी,[](int x){रिटर्न x*x;}); अदालत
A
9 9
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) b[2]=3^2=9. Output: 9.
व्याख्या (हिन्दी) बी[2]=3^2=9. आउटपुट: 9.
1636–1650 of 1915