OOP Using C++ — MCQ Practice

Hindi aur English dono mein practice karo — click karo answer check karne ke liye

📚 160 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
160 questions
151
EN + हिं
GB What is the output: int x=5; cout<<(x,x+1,x+2);
IN आउटपुट क्या है: int x=5; अदालत
A
7 7
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Comma returns rightmost: x+2=7. Output: 7.
व्याख्या (हिन्दी) अल्पविराम सबसे दाहिनी ओर लौटता है: x+2=7. आउटपुट: 7.
152
EN + हिं
GB What is the output: char s[6]="hello"; cout<
IN आउटपुट क्या है: char s[6]='हैलो'; अदालत
A
5 5
B
6 6
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) strlen counts to null: 5. Output: 5.
व्याख्या (हिन्दी) स्ट्रलेन की गिनती शून्य: 5. आउटपुट: 5.
153
EN + हिं
GB What is the output: int x=100; cout<<(x/=3)<
IN आउटपुट क्या है: int x=100; अदालत
A
3333 3333
B
10033 10033
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x/=3: x=33. C++17 left-to-right: print 33, then print 33. Output: 3333.
व्याख्या (हिन्दी) x/=3: x=33. C++17 बाएँ से दाएँ: 33 प्रिंट करें, फिर 33 प्रिंट करें। आउटपुट: 3333।
154
EN + हिं
GB What is the output: double x=2.5; int y=x; double z=y; cout<<(x==z);
IN आउटपुट क्या है: डबल x=2.5; int y=x; डबल z=y; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) y=2 (truncated); z=2.0. 2.5!=2.0. Output: 0.
व्याख्या (हिन्दी) y=2 (छोटा); z=2.0. 2.5!=2.0. आउटपुट: 0.
155
EN + हिं
GB What is the output: int x=5; cout<<(+x)<<(-x)<<(~x)<<(!x);
IN आउटपुट क्या है: int x=5; अदालत
A
5-5-60 5-5-60
B
5-50 5-50
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) +5=5, -5=-5, ~5=-6, !5=0. Output: 5-5-60.
व्याख्या (हिन्दी) +5=5, -5=-5, ~5=-6, !5=0. आउटपुट: 5-5-60.
156
EN + हिं
GB What is the output: int x=15; cout<
IN आउटपुट क्या है: int x=15; अदालत
A
f 17 15 एफ 17 15
B
F 17 15 एफ 17 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) hex 15=f (lowercase), oct 15=17, dec=15. Output: f 17 15.
व्याख्या (हिन्दी) हेक्स 15=एफ (लोअरकेस), अक्टूबर 15=17, दिसंबर=15। आउटपुट: एफ 17 15.
157
EN + हिं
GB What is the output: string s="12345"; int x=stoi(s); cout<
IN आउटपुट क्या है: स्ट्रिंग s='12345'; int x=stoi(s); अदालत
A
24690 24690
B
2468 2468
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) stoi("12345")=12345. 12345*2=24690. Output: 24690.
व्याख्या (हिन्दी) स्टोई("12345")=12345. 12345*2=24690. आउटपुट: 24690.
158
EN + हिं
GB What is the output: int x=5; int* p=nullptr; p=&x; cout<<(p?*p:-1);
IN आउटपुट क्या है: int x=5; int* p=nullptr; पी=&x; अदालत
A
5 5
B
-1 -1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) p=&x (not null); *p=5. Output: 5.
व्याख्या (हिन्दी) p=&x (शून्य नहीं); *पी=5. आउटपुट: 5.
159
EN + हिं
GB What is the output: auto x=5; auto y=5.0; cout<<(x==y);
IN आउटपुट क्या है: ऑटो x=5; ऑटो y=5.0; अदालत
A
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) x converted to double=5.0; 5.0==5.0=true=1. Output: 1.
व्याख्या (हिन्दी) x को डबल=5.0 में परिवर्तित किया गया; 5.0==5.0=सत्य=1. आउटपुट: 1.
160
EN + हिं
GB What is the output: int x=5; int y=x++; int z=++x; cout<
IN आउटपुट क्या है: int x=5; int y=x++; int z=++x; अदालत
A
757 757
B
776 776
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) y=x++=5(x=6); z=++x=7(x=7). x=7,y=5,z=7. Output: 757.
व्याख्या (हिन्दी) y=x++=5(x=6); z=++x=7(x=7). x=7,y=5,z=7. आउटपुट: 757.
151–160 of 160