Spent some time searching, couldn't find exactly what I'm after.
We like giving hands-on programming exercises as part of the interview process. The interviewee gets a laptop, with the editor and compiler of his choice. He or she then get a programming exercise and has about an hour to code it. Depending on the nature of the question, internet access is either allowed or forbidden.
I'm looking for good general questions for a junior developer. I don't care what language they choose to program in. C++ is as good as Python or Scheme, as long as (s)he can program in it (this rules out "can you write a correct copy-constructor" style questions). I just want to see how they code, if their code is self-documenting, if they write tests, check edge-cases, etc.
What kind of questions would you ask?
edit: The questions should be simple. I'd probably go with a question I can solve well in no more than 20 minutes. However, this is not the first stage in the interview process, and I can assume the person in front of me knows how to program.
c is a complex number. Z(n+1) = Z(n)^2 + c Z0 = 0 c belongs to the set M iff |Z(n)| < 2 for all natural n For all c between (-2, -i) to (2, i), print: 'X' if c is in M '.' otherwise
This looks like a scary mathematical problem, but it's actually very easy, and can be coded in under 10 minutes. Once you get the correct answer, it is visually obvious that you have the correct solution
edit: If the candidate doesn't remember his complex numbers, I show them everything they need about it. I want to see if they can look at a scary problem, and know which questions to ask. For example, you have to use
SOME_BIG_NUMBER in the partial solution below
def isInSet( c ): z_n = complex(0, 0) for i in range(1, SOME_BIG_NUMBER): z_n = z_n**2 + c if abs(z_n) > 2: return False return True