— USS Clueless – Interviewing college grads says he likes to give syntax tests to job applicants, such as one where the right answer is:
do {
*destination = *source;
} while (*source != 0);
Personally, I would code this as:
while ( (*dest++ = *source++) != 0);
since this form is more compact and it’s an idiom that “C” programmers had better understand if they are maintaining other peoples’ code.
I interviewed for several jobs last year before settling on the pre-IPO startup I selected, and several of them gave me coding tests. I’ve been programming for over 20 years, and this kind of thing annoys me immensely. I think it’s reasonable to ask people system design questions, such as “how would you go about solving this problem?”, but programming tests that focus on syntactic details are just plain wrong unless you’re looking for an obedient code-monkey with no ability to think creatively or to solve problems. You have only so much time in an interview, and wasting it with this kind of thing takes away from the time you should be spending looking for more important things.
I’m working for a company that builds products conforming to the 802.11 standard. As it turns out, I was one of the people who designed the original MAC protocol spec for 802.11. Should anyone seriously have asked me about “C” syntax in an interview for this job?
One interesting experience I had at [high-profile router startup] was with a guy who was supposed to be the OS expert who wanted to talk about inhibiting scheduling in a pre-emptive OS. I explained all of the various methods for doing that, including system calls and the CLI machine instruction on Intel processors. The yahoo wanted to know what happens if two processes issue a CLI but only one issues a STI, believing that this instruction nests.
When I pointed out to him that there’s a single bit interrupt mask in the CPU, so the example was far-fetched at best, and then explained that the first STI would restore scheduling, he got mad at me and said I didn’t know what I was talking about.
I don’t think that company is going to do very well.