
-----------------------------------
wtd
Sat Mar 03, 2007 8:59 pm

How would you fare in an interview?
-----------------------------------
A task that might be posed in an interview:

Write a function which prints the numbers from 0 to 100.  But, for each multiple of 3, it prints "Fizz" instead of the number.  For each multiple of 5, it prints "Buzz" instead of the number and for multiples of both 3 and 5, it prints "FizzBuzz" instead of the number.

Don't post code for this, just write it out on paper.   Pick whatever language you please, but no psuedocode.

Can you do it in a few minutes? 

Congrats!  Surprisingly few programmers applying for jobs even at the senior level can manage this.

Now, test your code.  Did it produce the correct output?

Even fewer programmers get the function right if they can write it at all.

-----------------------------------
md
Sat Mar 03, 2007 9:11 pm

RE:How would you fare in an interview?
-----------------------------------
Heh, it really is surprising how many people can't actually do this.

-----------------------------------
neufelni
Sat Mar 03, 2007 9:25 pm

Re: How would you fare in an interview?
-----------------------------------
I tried it, and sadly, I was unsuccessful. I had a few little mistakes. I used Python, and forgot the () in my function declaration and the function call. Also didn't make it so that it didn't count 0 as a multiple of 3 or 5.

-----------------------------------
wtd
Sat Mar 03, 2007 9:31 pm

Re: How would you fare in an interview?
-----------------------------------
Also didn't make it so that it didn't count 0 as a multiple of 3 or 5.

This was not required.

-----------------------------------
bugzpodder
Sat Mar 03, 2007 9:32 pm

RE:How would you fare in an interview?
-----------------------------------
I read about that, and I don't believe it.  Anyone who has more than 1 year of programming experience should have NO problems doing this.  After all, it just consists of a loop, an if statement and output.

-----------------------------------
Clayton
Sat Mar 03, 2007 10:38 pm

Re: How would you fare in an interview?
-----------------------------------
bugz, the keyword there is *should*. Sure anyone with half a brain should be able to write that program, but without a keyboard and a monitor in front of them, many people seem helpless. Then they also have to worry about stupid little mistakes because they have no debugger to tell them they screwed up in their code. It's more of a mental thing if you ask me.

-----------------------------------
bugzpodder
Sat Mar 03, 2007 11:11 pm

RE:How would you fare in an interview?
-----------------------------------
thats not the point.  the interviewer also has no debugger so he/she can't compile your code mentally.  If he catches a mistake you didn't, just fix it.  phasing out on paper is a different issue, the original post on a blog implies that many people can't do this period (do a search on fizzbuzz) which i think is a ridiculous claim.

-----------------------------------
Tony
Sun Mar 04, 2007 12:22 am

RE:How would you fare in an interview?
-----------------------------------
I read the blog post, 199 of 200 seems to be an exauguration. Although writing code on a blank sheet of paper, with interviewing developers watching the clock is intimidating... I can see myself making some mistake, if the language choice is not mine.

-----------------------------------
bugzpodder
Sun Mar 04, 2007 1:18 am

RE:How would you fare in an interview?
-----------------------------------
they should be asking people to write a variant of binary search (returns the first position if the item is not in the list).  i think thats a pretty good interview question.

-----------------------------------
Martin
Sun Mar 04, 2007 2:56 pm

RE:How would you fare in an interview?
-----------------------------------
Easy!


cout 