200-901 · Question #273
200-901 Question #273: Real Exam Question with Answer & Explanation
The correct answer is B: to improve maintainability and readability. {"question_number": 6, "question": "Why is refactoring done during test-driven development?", "correct_answer": "B", "explanation": "In Test-Driven Development (TDD), the cycle is Red → Green → Refactor. After writing a failing test (Red) and making it pass with minimal code (Gre
Question
Why is refactoring done during test-driven development?
Options
- Ato enable larger objects and longer methods
- Bto improve maintainability and readability
- Cto ensure that the previous uses of the objects are explained
- Dto ensure the duplication of essential code
Explanation
{"question_number": 6, "question": "Why is refactoring done during test-driven development?", "correct_answer": "B", "explanation": "In Test-Driven Development (TDD), the cycle is Red → Green → Refactor. After writing a failing test (Red) and making it pass with minimal code (Green), refactoring is performed to improve the internal quality of the code without changing its behavior. The goal is to improve maintainability (easier to extend and modify) and readability (easier for other developers to understand). The existing tests serve as a safety net to confirm that refactoring did not break any functionality. Options A and D describe anti-patterns (larger objects, duplicated code) that refactoring is meant to eliminate. Option C is not a goal of refactoring.", "generated_by": "claude-sonnet", "llm_judge_score": 4}
Topics
Community Discussion
No community discussion yet for this question.