OOP Using C++ — MCQ Practice

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

📚 187 Questions 🌐 Hindi + English ✅ Free
भाषा / Language:
187 questions
151
EN + हिं
GB What is 'std::ranges::iota' (C++23)?
IN 'std::ranges::iota' (C++23) क्या है?
A
Fills range with sequentially incrementing values क्रमिक रूप से बढ़ते मानों के साथ श्रेणी भरता है
B
Same as std::iota std::iota के समान
C
A view एक दृश्य
D
Both A and B ए और बी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ranges::iota is the range version; views::iota creates a lazy iota view.
व्याख्या (हिन्दी) रेंज::आईओटा रेंज संस्करण है; दृश्य::iota एक आलसी iota दृश्य बनाता है।
152
EN + हिं
GB What is the output: auto v=views::iota(1,6)|views::transform([](int x){return x*x;}); cout<{});
IN आउटपुट क्या है: auto v=views::iota(1,6)|views::transform([](int x){return x*x;}); अदालत
A
55 55
B
15 15
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+4+9+16+25=55. Output: 55.
व्याख्या (हिन्दी) 1+4+9+16+25=55. आउटपुट: 55.
153
EN + हिं
GB What is 'std::ranges::fold_left' (C++23)?
IN 'std::ranges::fold_left' (C++23) क्या है?
A
Left fold over range with binary operation बाइनरी ऑपरेशन के साथ बाईं ओर की सीमा को मोड़ें
B
Same as accumulate संचय के समान
C
A reduce एक कमी
D
Both A and B ए और बी दोनों
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) ranges::fold_left(range,init,op) is equivalent to std::accumulate but works with ranges.
व्याख्या (हिन्दी) रेंज::फोल्ड_लेफ्ट(रेंज,इनिट,ऑप) std::accumute के बराबर है लेकिन रेंज के साथ काम करता है।
154
EN + हिं
GB What is the output: int x=5; cout<<(x<<1)-(x>>1);
IN आउटपुट क्या है: int x=5; अदालत
A
8 8
B
3 3
C
12 12
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10-2=8. Output: 8.
व्याख्या (हिन्दी) 10-2=8. आउटपुट: 8.
155
EN + हिं
GB What is the output: auto x=5; auto y=2; cout<<(x/y)<<(x%y);
IN आउटपुट क्या है: ऑटो x=5; ऑटो y=2; अदालत
A
21 21
B
25 25
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 5/2=2, 5%2=1. Output: 21.
व्याख्या (हिन्दी) 5/2=2, 5%2=1. आउटपुट: 21.
156
EN + हिं
GB What is the output: constexpr int arr[]={1,2,3,4,5}; constexpr int s=arr[0]+arr[4]; cout<
IN आउटपुट क्या है: constexpr int arr[]={1,2,3,4,5}; constexpr int s=arr[0]+arr[4]; अदालत
A
6 6
B
5 5
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 1+5=6. Output: 6.
व्याख्या (हिन्दी) 1+5=6. आउटपुट: 6.
157
EN + हिं
GB What is the output: int x=0b1010; int y=0b0101; cout<<(x+y);
IN आउटपुट क्या है: int x=0b1010; int y=0b0101; अदालत
A
15 15
B
10 10
C
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 10+5=15. Output: 15.
व्याख्या (हिन्दी) 10+5=15. आउटपुट: 15.
158
EN + हिं
GB What is the output: string s="hello"; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; अदालत
A
5ho 5हो
B
5he 5वह
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) length=5, s[0]='h', back='o'. Output: 5ho.
व्याख्या (हिन्दी) लंबाई=5, s[0]='h', पीछे='o'। आउटपुट: 5ho.
159
EN + हिं
GB What is 'std::string::npos'?
IN 'std::string::npos' क्या है?
A
Maximum value of size_t; returned when search fails size_t का अधिकतम मान; खोज विफल होने पर वापस आ गया
B
A null pointer एक शून्य सूचक
C
Zero index शून्य सूचकांक
D
End iterator पुनरावर्तक समाप्त करें
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) npos = string::size_type(-1); find() returns it when pattern not found.
व्याख्या (हिन्दी) npos = स्ट्रिंग::आकार_प्रकार(-1); पैटर्न नहीं मिलने पर ढूंढें() इसे वापस कर देता है।
160
EN + हिं
GB What is the output: string s="hello world"; cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो वर्ल्ड'; अदालत
A
6 6
B
5 5
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 'world' starts at index 6. Output: 6.
व्याख्या (हिन्दी) 'दुनिया' सूचकांक 6 से शुरू होती है। आउटपुट: 6।
161
EN + हिं
GB What is the output: string s="abcde"; s.erase(1,3); cout<
IN आउटपुट क्या है: स्ट्रिंग s='abcde'; s.मिटाना(1,3); अदालत
A
ae
B
bcde बीसीडीई
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Remove b,c,d leaving a,e. Output: ae.
व्याख्या (हिन्दी) ए,ई छोड़कर बी,सी,डी हटाएं। आउटपुट: एई.
162
EN + हिं
GB What is the output: string s="hello"; s.insert(2,"XY"); cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो'; s.insert(2,"XY"); अदालत
A
heXYllo heXYllo
B
hXYello hXYello
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Insert at pos 2: he+XY+llo. Output: heXYllo.
व्याख्या (हिन्दी) स्थिति 2 पर डालें: he+XY+llo. आउटपुट: heXYllo.
163
EN + हिं
GB What is the output: string s="Hello World"; transform(s.begin(),s.end(),s.begin(),::tolower); cout<
IN आउटपुट क्या है: स्ट्रिंग s='हैलो वर्ल्ड'; transform(s.begin(),s.end(),s.begin(),::tolower); अदालत
A
hello world हैलो वर्ल्ड
B
HELLO WORLD हैलो वर्ल्ड
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) All chars lowercased. Output: hello world.
व्याख्या (हिन्दी) सभी वर्ण छोटे कर दिये गये। आउटपुट: हेलो वर्ल्ड.
164
EN + हिं
GB What is the output: stringstream ss; ss<<1<<' '<<2<<' '<<3; int a,b,c; ss>>a>>b>>c; cout<
IN आउटपुट क्या है: स्ट्रिंगस्ट्रीम एसएस; एस एस
A
6 6
B
3 3
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Parse 1,2,3. Sum=6. Output: 6.
व्याख्या (हिन्दी) पार्स 1,2,3. योग=6. आउटपुट: 6.
165
EN + हिं
GB What is the output: int x=42; string s=to_string(x); cout<
IN आउटपुट क्या है: int x=42; स्ट्रिंग s=to_string(x); अदालत
A
24 24
B
42 42
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) "42" has size 2, s[0]='4'. Output: 24.
व्याख्या (हिन्दी) "42" का आकार 2 है, s[0]='4'। आउटपुट: 24.
151–165 of 187