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
751
EN + हिं
GB What is 'std::ranges::views::filter'?
IN 'std::ranges::views::filter' क्या है?
A
Lazy view filtering elements by predicate विधेय द्वारा तत्वों को फ़िल्टर करने का आलसी दृश्य
B
A sorted view एक क्रमबद्ध दृश्य
C
A transform view एक परिवर्तन दृश्य
D
An owning container एक मालिकाना कंटेनर
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) views::filter creates a lazy range that skips elements not satisfying the predicate.
व्याख्या (हिन्दी) दृश्य::फ़िल्टर एक आलसी श्रेणी बनाता है जो विधेय को संतुष्ट नहीं करने वाले तत्वों को छोड़ देता है।
752
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<<*find_if(a,a+5,[](int x){return x*x>10;});
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
4 4
B
3 3
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 3^2=9<=10; 4^2=16>10. Output: 4.
व्याख्या (हिन्दी) 3^2=910. आउटपुट: 4.
753
EN + हिं
GB What is the output: string s="hello"; reverse(s.begin(),s.end()); cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; रिवर्स(s.begin(),s.end()); अदालत
A
olleh ओलेह
B
hello नमस्ते
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Output: olleh.
व्याख्या (हिन्दी) आउटपुट: ओलेह.
754
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; अदालत
A
12345 12345
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0*10+1=1, 1*10+2=12, 12*10+3=123, ..., 12345. Output: 12345.
व्याख्या (हिन्दी) 0*10+1=1, 1*10+2=12, 12*10+3=123, ..., 12345। आउटपुट: 12345।
755
EN + हिं
GB What is the output: array a={4,3,2,1}; sort(a.begin(),a.end()); cout<
IN आउटपुट क्या है: array a={4,3,2,1}; सॉर्ट करें (a.begin(),a.end()); अदालत
A
14 14
B
41 41
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Sorted: 1,2,3,4. front=1,back=4. Output: 14.
व्याख्या (हिन्दी) क्रमबद्ध: 1,2,3,4. आगे = 1, पीछे = 4. आउटपुट: 14.
756
EN + हिं
GB What is the output: int a=5,b=10; int *p=&a; *p=*p+b; cout<
IN आउटपुट क्या है: int a=5,b=10; int *p=&a; *पी=*पी+बी; अदालत
A
15 15
B
10 10
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) a=5+10=15. Output: 15.
व्याख्या (हिन्दी) ए=5+10=15. आउटपुट: 15.
757
EN + हिं
GB What is the output: int *p=new int(10); auto sp=shared_ptr(p); auto sp2=shared_ptr(p); cout<
IN आउटपुट क्या है: int *p=new int(10); ऑटो एसपी=shared_ptr(p); ऑटो sp2=shared_ptr(p); अदालत
A
1 1
B
2 2
C
Undefined behavior अपरिभाषित व्यवहार
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Two separate shared_ptrs from same raw pointer: double-free UB when both try to delete.
व्याख्या (हिन्दी) एक ही रॉ पॉइंटर से दो अलग-अलग साझा_पीटीआर: जब दोनों हटाने का प्रयास करते हैं तो डबल-फ्री यूबी।
758
EN + हिं
GB 'What is the output: int a[]={1,2,3}; int *p=a+1; cout<<*( (1, 6, 77, 7, 4, 'What is the output: int x=5; int *p=&x; int **pp=&p; **pp=20; cout<
IN 'आउटपुट क्या है: int a[]={1,2,3}; int *p=a+1; अदालत
A
30}; int *p=&a[2]; cout<<*p<<*(p-1)<<*(p-2);', 'Pointer from end: *p 30}; int *p=&a[2]; अदालत
B
*(p-2)?', '302010', '302010', '102030', '102030', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', '*p=30 *(पी-2)?', '302010', '302010', '102030', '102030', 'संकलन त्रुटि', 'संकलन त्रुटि', 'अपरिभाषित', 'अपरिभाषित', शून्य, 'विकल्प_ए', '*पी=30
C
*(p-2)=10. Output: 302010.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: void f(int **p,int v){**p=v;} int x=0; int *px=&x; f(&px,42); cout<<x;', 'Pass pointer-to-pointer to function?', '42', '42', '0', '0', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', '**p=*px=x=42. Output: 42.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: auto up=make_unique<int[]>(3); up[0]=1;up[1]=2;up[2]=3; cout<<up[0]+up[2];', 'unique_ptr array sum?', '4', '4', '6', '6', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', '1+3=4. Output: 4.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'What is the output: int x=10; auto sp=make_shared<int>(x); cout<<sp.use_count()<<*sp;', 'shared_ptr basic?', '110', '110', '101', '101', 'Compile error', 'Compile error', 'Undefined', 'Undefined', NULL, 'option_a', 'use_count=1 *(पी-2)=10. आउटपुट: 302010.', 0, '2026-05-25', '2026-05-25'), (1, 6, 77, 7, 4, 'आउटपुट क्या है: void f(int **p,int v){**p=v;} int x=0; int *px=&x; f(&px,42); cout
D
2 2
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Null check before deref?
व्याख्या (हिन्दी) डेरेफ़ से पहले शून्य जाँच?
759
EN + हिं
GB What is the output: int x=5; int *p=&x; int **pp=&p; **pp=20; cout<
IN आउटपुट क्या है: int x=5; int *p=&x; int **pp=&p; **पीपी=20; अदालत
A
20 20
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) **pp=*p=x=20. Output: 20.
व्याख्या (हिन्दी) **पीपी=*पी=एक्स=20. आउटपुट: 20.
760
EN + हिं
GB What is the output: int a[]={10,20,30}; int *p=&a[2]; cout<<*p<<*(p-1)<<*(p-2);
IN आउटपुट क्या है: int a[]={10,20,30}; int *p=&a[2]; अदालत
A
302010 302010
B
102030 102030
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) *p=30,*(p-1)=20,*(p-2)=10. Output: 302010.
व्याख्या (हिन्दी) *पी=30,*(पी-1)=20,*(पी-2)=10. आउटपुट: 302010.
761
EN + हिं
GB What is the output: void f(int **p,int v){**p=v;} int x=0; int *px=&x; f(&px,42); cout<
IN आउटपुट क्या है: void f(int **p,int v){**p=v;} int x=0; int *px=&x; f(&px,42); अदालत
A
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) **p=*px=x=42. Output: 42.
व्याख्या (हिन्दी) **p=*px=x=42. आउटपुट: 42.
762
EN + हिं
GB What is the output: auto up=make_unique(3); up[0]=1;up[1]=2;up[2]=3; cout<
IN आउटपुट क्या है: auto up=make_unique(3); ऊपर[0]=1;ऊपर[1]=2;ऊपर[2]=3; अदालत
A
4 4
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+3=4. Output: 4.
व्याख्या (हिन्दी) 1+3=4. आउटपुट: 4.
763
EN + हिं
GB What is the output: int x=10; auto sp=make_shared(x); cout<
IN आउटपुट क्या है: int x=10; ऑटो एसपी=make_shared(x); अदालत
A
110 110
B
101 101
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) use_count=1, *sp=10. Output: 110.
व्याख्या (हिन्दी) उपयोग_गिनती=1, *एसपी=10. आउटपुट: 110.
764
EN + हिं
GB What is the output: int a[]={1,2,3,4,5}; int *p=a; cout<
IN आउटपुट क्या है: int a[]={1,2,3,4,5}; int *p=a; अदालत
A
4 4
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p[3]=*(p+3)=a[3]=4. Output: 4.
व्याख्या (हिन्दी) पी[3]=*(पी+3)=ए[3]=4. आउटपुट: 4.
765
EN + हिं
GB What is the output: int *p=nullptr; if(p) cout<<*p; else cout<<'N';
IN आउटपुट क्या है: int *p=nullptr; यदि (पी) कोउट
A
N एन
B
Undefined अपरिभाषित
C
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p is null; if(p) false; else prints N. Output: N.
व्याख्या (हिन्दी) पी शून्य है; यदि (पी) गलत; अन्यथा एन प्रिंट करता है। आउटपुट: एन।
751–765 of 1915