I was recently on an interview with a candidate who mentioned that his programming team (he is a manager) will often pass around interesting programming quizzes or challenges they learn about as a fun way to keep the mental floss going, (or secretly prepare for job interviews).
One such test is called FizzBuzz. This is a pretty simple test that comes from a math game that many children (apparently common in the UK) play.
The question, altered for programming, is posed as:
“Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.” #permalink
Near as I can tell, the relative popularity of this coding test comes from a post by Imran Ghory called “Using FizzBuzz to Find Developers Who Grok Coding” along with a popular commentary on this by Jeff Atwood called “Why Can’t Programmers.. Program?” along with observations from several others about this that programmers are having a pretty hard time, well, programming.
I’m starting to get a little worried. I’m more than willing to cut freshly minted software developers slack at the beginning of their career. Everybody has to start somewhere. But I am disturbed and appalled that any so-called programmer would apply for a job without being able to write the simplest of programs. That’s a slap in the face to anyone who writes software for a living.
The vast divide between those who can program and those who cannot program is well known. I assumed anyone applying for a job as a programmer had already crossed this chasm. Apparently this is not a reasonable assumption to make. Apparently, FizzBuzz style screening is required to keep interviewers from wasting their time interviewing programmers who can’t program.#
- So, have you ever done the FizzBuzz test?
- How would you implement a solution to this test?
- What are other coding challenges like this that you have seen? …Designed to be “blindingly, intentionally easy”… you either know it or you don’t type questions?
- Bonus question: What very LAME or IMPRACTICAL coding tests have you witnessed or (sadly) had thrust upon ye?
Interestingly, in a recent follow up on this from about a year ago, Joey Devilla calls FizzBuzz his “Sorting Hat” and notes that FizzBuzz still works, and results in only a 40% success rate for the programmers he quizzes with it.
And this funny picture:
Post your code result below (or link to it in your comment)?