ITPEC IP April 2026 Question 50
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 an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official IP past-paper collection or Report an issue.