IPA IP 2021 Question 48
A question IPA Japan published in 令和3年度 ITパスポート試験 公開問題 問48, translated into English. ITPEC is based on the same exams.
Same question on ITPEC: Apr 2026 Q50
Which of the following is the most appropriate activity of improving the internal structure of an existing program without changing the external behavior of the software?
Explanation
Refactoring — improving a program's internal structure without changing what it does from the outside.
Refactoring removes duplicated code, splits long procedures, renames unclear variables and simplifies dependencies, making the program easier to read and change. Its outputs for any input stay the same, and automated tests are rerun after each small change to confirm that. It is a core practice of agile methods such as XP.
Answer (d)
Why not others:
- •(a) Test driven development — write a failing test first, then just enough code to pass it; refactoring is one step of its cycle, but TDD as a whole builds new behaviour
- •(b) Pair programming — two programmers work at one computer, one writing and one reviewing; it is about how code is written, not restructuring existing code
- •(c) Reverse engineering — analyses an existing program to recover its specifications or design; it reads the structure rather than improving it
Key rule: Refactoring changes structure but keeps behaviour, and tests are what prove the behaviour is unchanged.
Software Development Management Techniques · AI-written, may contain errors
This question comes from the past questions IPA Japan publishes, translated into English by ITPEC Practice. ITPEC Practice is an independent study tool and is not affiliated with IPA or ITPEC. See the original paper (PDF) or Report an issue.