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
511
EN + हिं
GB What is the output: int x=5; cout<<(x*x-1)/(x+1);
IN आउटपुट क्या है: int x=5; अदालत
A
4 4
B
5 5
C
6 6
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) (25-1)/(6)=24/6=4. Output: 4.
व्याख्या (हिन्दी) (25-1)/(6)=24/6=4. आउटपुट: 4.
512
EN + हिं
GB What is 'std::latch' in C++20?
IN C++20 में 'std::latch' क्या है?
A
Single-use countdown synchronization primitive एकल-उपयोग उलटी गिनती तुल्यकालन आदिम
B
Mutex wrapper म्यूटेक्स आवरण
C
Semaphore सिकंदरा
D
Barrier रुकावट
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::latch counts down to zero; threads wait until count reaches zero; not reusable.
व्याख्या (हिन्दी) std::latch की गिनती शून्य तक; गिनती शून्य तक पहुंचने तक धागे प्रतीक्षा करते हैं; पुन: प्रयोज्य नहीं.
513
EN + हिं
GB What is the output: auto x=2; auto y=3; cout<
IN आउटपुट क्या है: ऑटो x=2; ऑटो y=3; अदालत
A
3 3
B
3.33 3.33
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) decltype(x+y) is int. int(10)/3=3. Output: 3.
व्याख्या (हिन्दी) decltype(x+y) int है। int(10)/3=3. आउटपुट: 3.
514
EN + हिं
GB What is 'std::barrier' in C++20?
IN C++20 में 'std::barrier' क्या है?
A
Reusable synchronization point where all threads must arrive पुन: प्रयोज्य सिंक्रनाइज़ेशन बिंदु जहां सभी थ्रेड्स अवश्य पहुंचने चाहिए
B
A mutex एक म्यूटेक्स
C
A semaphore एक सेमाफोर
D
A latch एक कुंडी
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::barrier is a reusable barrier; threads block until all arrive, then completion function runs.
व्याख्या (हिन्दी) std::बैरियर एक पुन: प्रयोज्य बैरियर है; सभी थ्रेड्स आने तक ब्लॉक रहते हैं, फिर कंप्लीशन फ़ंक्शन चलता है।
515
EN + हिं
GB What is the output: int x=100; cout<<(x&(-x)==x);
IN आउटपुट क्या है: int x=100; अदालत
B
1 1
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 100&(-100)=4≠100. So 4==100=false=0. Output: 0.
व्याख्या (हिन्दी) 100&(-100)=4≠100. तो 4==100=असत्य=0. आउटपुट: 0.
516
EN + हिं
GB What is 'std::counting_semaphore' in C++20?
IN C++20 में 'std::counting_semafore' क्या है?
A
Semaphore with configurable count for resource limiting संसाधन सीमित करने के लिए विन्यास योग्य गणना के साथ सेमाफोर
B
A mutex variant एक म्यूटेक्स वैरिएंट
C
A thread pool एक थ्रेड पूल
D
A barrier variant एक बाधा संस्करण
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::counting_semaphore allows up to N concurrent acquires; useful for resource pools.
व्याख्या (हिन्दी) std::counting_semafore एन समवर्ती अधिग्रहण तक की अनुमति देता है; संसाधन पूल के लिए उपयोगी.
517
EN + हिं
GB What is the output: int x=7; cout<<(x|(x-1));
IN आउटपुट क्या है: int x=7; अदालत
A
7 7
B
6 6
C
15 15
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 7=111, 6=110. 111|110=111=7. Output: 7.
व्याख्या (हिन्दी) 7=111, 6=110. 111|110=111=7. आउटपुट: 7.
518
EN + हिं
GB What is 'std::stop_token' in C++20?
IN C++20 में 'std::stop_token' क्या है?
A
Mechanism for cooperative thread cancellation सहकारी धागा रद्दीकरण के लिए तंत्र
B
A mutex एक म्यूटेक्स
C
An atomic flag एक परमाणु ध्वज
D
A future एक भविष्य
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::stop_token allows threads to check if cancellation was requested; used with std::jthread.
व्याख्या (हिन्दी) std::stop_token थ्रेड्स को यह जांचने की अनुमति देता है कि क्या रद्दीकरण का अनुरोध किया गया था; std::jthread के साथ प्रयोग किया जाता है।
519
EN + हिं
GB What is the output: constexpr int f(int n){return n<=1?1:n*f(n-1);} cout<
IN आउटपुट क्या है: constexpr int f(int n){return n
A
720 720
B
120 120
C
Compile error संकलन त्रुटि
D
Undefined अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 6!=720. Output: 720.
व्याख्या (हिन्दी) 6!=720. आउटपुट: 720.
520
EN + हिं
GB What is 'std::coroutine_handle'?
IN 'std::coroutine_handle' क्या है?
A
Low-level handle to resume/destroy a suspended coroutine निलंबित कोरआउटिन को फिर से शुरू/नष्ट करने के लिए निम्न-स्तरीय हैंडल
B
A thread handle एक धागे का हैंडल
C
A future handle एक भविष्य का हैंडल
D
A fiber handle एक फाइबर हैंडल
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) std::coroutine_handle

wraps a coroutine frame pointer; .resume() continues execution from suspension point.

व्याख्या (हिन्दी) std::coroutine_handle एक coroutine फ़्रेम पॉइंटर को लपेटता है; .resume() निलंबन बिंदु से निष्पादन जारी रखता है।
521
EN + हिं
GB What is the output: int x=0; cout<<(x?'T':'F');
IN आउटपुट क्या है: int x=0; अदालत
A
F एफ
B
T टी
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) 0 is false; ternary returns 'F'. Output: F.
व्याख्या (हिन्दी) 0 गलत है; टर्नरी रिटर्न 'एफ'। आउटपुट: एफ.
522
EN + हिं
GB What is 'value category' in C++?
IN C++ में 'मूल्य श्रेणी' क्या है?
A
lvalue/prvalue/xvalue: classifies expressions lvalue/prvalue/xvalue: भावों को वर्गीकृत करता है
B
Data type category डेटा प्रकार श्रेणी
C
Template category टेम्पलेट श्रेणी
D
Storage class भंडारण वर्ग
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Value categories determine move/copy semantics and whether address can be taken.
व्याख्या (हिन्दी) मूल्य श्रेणियां चाल/कॉपी शब्दार्थ निर्धारित करती हैं और क्या पता लिया जा सकता है।
523
EN + हिं
GB What is the output: long long x=1234567890123; cout<
IN आउटपुट क्या है: long long x=1234567890123; अदालत
A
1234567890123 1234567890123
B
Compile error संकलन त्रुटि
C
Undefined अपरिभाषित
D
Truncated छंटनी की गई
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) Long long holds up to ~9.2e18. Output: 1234567890123.
व्याख्या (हिन्दी) ~9.2e18 तक लंबे समय तक टिके रहते हैं। आउटपुट: 1234567890123।
524
EN + हिं
GB What is 'std::numeric_limits::epsilon()'?
IN 'std::numeric_limits::epsilon()' क्या है?
A
Smallest float difference from 1.0 1.0 से सबसे छोटा फ्लोट अंतर
B
Machine precision मशीन परिशुद्धता
C
Float max value फ़्लोट अधिकतम मान
D
Float min positive फ्लोट न्यूनतम सकारात्मक
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) epsilon is the smallest float e such that 1.0+e != 1.0; ~1.19e-7 for float.
व्याख्या (हिन्दी) एप्सिलॉन सबसे छोटा फ्लोट ई है जैसे कि 1.0+e != 1.0; फ्लोट के लिए ~1.19e-7।
525
EN + हिं
GB What is the output: int x=5; auto y=x; auto& z=x; z=10; cout<
IN आउटपुट क्या है: int x=5; ऑटो y=x; ऑटो& z=x; z=10; अदालत
A
105 105
B
1010 1010
C
55 55
D
Compile error संकलन त्रुटि
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English) z is ref to x; z=10 sets x=10. y is copy=5. Output: 105.
व्याख्या (हिन्दी) z, x का संदर्भ है; z=10 सेट x=10. y प्रतिलिपि = 5 है। आउटपुट: 105.
511–525 of 1915