2341
GB
What is 'assertion-driven debugging' and how does it prevent future regression of the same bug?
IN
'अभिकथन-संचालित डिबगिंग' क्या है और यह उसी बग के भविष्य के प्रतिगमन को कैसे रोकता है?
A
Assertion-driven debugging uses assert statements to automatically fix bugs at runtime
अभिकथन-संचालित डिबगिंग रनटाइम पर बग को स्वचालित रूप से ठीक करने के लिए अभिकथन कथन का उपयोग करता है
B
Assertion-driven debugging adds runtime assertions that document the discovered invariant violated by the bug — after fixing the bug the assertion remains in the code, forming an executable specification that catches the same fault if it ever recurs
अभिकथन-संचालित डिबगिंग रनटाइम अभिकथन जोड़ता है जो बग द्वारा उल्लंघन किए गए खोजे गए अपरिवर्तनीय दस्तावेज को दस्तावेज करता है - बग को ठीक करने के बाद अभिकथन कोड में रहता है, एक निष्पादन योग्य विनिर्देश बनाता है जो उसी गलती को पकड़ता है यदि यह कभी भी दोहराया जाता है
C
Assertion-driven debugging is identical to TDD and both terms describe the same practice
अभिकथन-संचालित डिबगिंग टीडीडी के समान है और दोनों शब्द एक ही अभ्यास का वर्णन करते हैं
D
Assertions must always be removed from production builds to avoid performance overhead
प्रदर्शन ओवरहेड से बचने के लिए दावे को हमेशा उत्पादन बिल्ड से हटा दिया जाना चाहिए
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
When you discover that a critical function was being called with a null parameter (causing crash), add: assert(param != null, 'param must not be null — see bug #1234'). This assertion: 1) documents the invariant for future readers, 2) catches the same bug immediately if the calling code regresses, 3) provides a specific error message that eliminates investigation time. This transforms a one-time fix into a permanent guard.
व्याख्या (हिन्दी)
जब आपको पता चलता है कि एक महत्वपूर्ण फ़ंक्शन को शून्य पैरामीटर (क्रैश का कारण) के साथ कॉल किया जा रहा था, तो जोड़ें: ज़ोर (परम! = शून्य, 'परम शून्य नहीं होना चाहिए - बग #1234 देखें')। यह दावा: 1) भविष्य के पाठकों के लिए अपरिवर्तनीय दस्तावेज, 2) कॉलिंग कोड वापस आने पर तुरंत उसी बग को पकड़ लेता है, 3) एक विशिष्ट त्रुटि संदेश प्रदान करता है जो जांच के समय को समाप्त कर देता है। यह एक बार के फिक्स को स्थायी गार्ड में बदल देता है।