Capgemini interview question

How to refactor a piece of code.