Give the candidate a real piece of code, ask them what it does, ask them to improve the code, and then ask them to add a new feature to the code.