Ask them to write some code in a suitable language that performs a common function like strstr()/string.IndexOf(str), itoa()/int.toString(). You choose - best to have a number of options if a newbie isn't familiar with the function.
Leave them alone for a few minutes to do this. The language doesn't really matter - something appropriate will do, as long as no library calls (at all). It doesn't have to compile and run - but you could do this together when they're done, just for kicks. Obviously, no access to the web for this exercise.
This should demonstrate:
- Can the candidate write code at all.
- Can solve programming/algorithmic problems. If they're nowhere near a reasonable solution, no point in continuing the interview.
- Do they write maintainable code? Do they demonstrate an understanding that other team members might adapt their code?
- Is there any consistent style to the coding? It doesn't have to match your in-house style, but do they write consistently-styled code that is easy to read.
- Can they talk through their code? Do they get too defensive when you critique it? How do they respond to feedback?
Using this technique I have identified:
- Candidates that can talk their way through the interview and then crumble when asked to write code.
- Candidates that bought in print outs of someone else's code as an example of their own work.
- High-scoring graduates that couldn't get their head around an 'isUpperCase(char)' function.
- A guy who got aggressive and then then threatened the HR person and I who were interviewing him once we started to work through his code, giving him feedback on different approaches.
Update, 4 years on:
We've now started using an online code collaboration tool so that the interview candidate can put their phone headset on while talking to the interviewer and both can collaborate with code. The tool we use has a 'Run This Code' button which compiles and runs the code on demand.
We've found that this process very quickly filters out the people who just cannot code at all, and as the interview is done remotely, much less logistical headaches with travel, meeting rooms, etc.