I find it much more likely that the fizzbuzz failers are the students who wanted to copy my programming projects in undergrad.
I've seen this for people that were hired and proved excellent.
Everyone can do Fizzbuzz or reverse a string on the job. Much less can do it correctly the first time, on a whiteboard, in a job interview. When you hire a carpenter, you don't ask him to hit a nail with a plastic hammer while you watch.
When this happens to me, people in the interview tell me something like "This is easy, are there strings attached I can't see?"
Whatever happened to, "he seem to be able to code, let's try it for a couple weeks"?
Happened to me twice where everything was fine and then after having been interviewed by 5 or more people, one of them has a bad feeling, and you're not given a chance to prove yourself in a probationary period. Situations like that made me wonder if freelancing is a better path.
Even in these circumstances I've had a decent proportion of candidates never able to even begin to outline some code, let alone get far enough in to enounter "tricks" or "pitfalls". These are candidates I'm comfortable assuming have not learned to code.
I code for fun mostly and I feel like even my 'basic' level knowledge should be able to outline code for a simple problem like fizzbuzz or string reversal.
Mind still blown? Yeah, well, it happens more than you think. Varying definitions for "SDET" are out there, but I think most would agree that an SDET should be able to code. I've had SDETs with Microsoft on their resume that couldn't even match curly braces, let alone write something that would compile and work.
So I use FizzBuzz or an equivalent. I tell the candidate up front that it should take them single digit minutes. I offer points for creativity if they find it too simple. And once in a while a candidate with ten years experience shows up who can't do it. Glad we didn't start with that red/black tree implementation, then.
[0] Why more common with SDETs? My theory is that SDET is easier to fake, and if your SDET "development" consists of var foo=FindUIElement("bar");foo.click(), then FizzBuzz could give you trouble.
Same here.
'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”.'
It spells out in words what needs to be written in code.
String reverse is: Write a method/function that returns the reverse of it's argument. Would be interested to learn how these are trick questions.
If the solution is fine, I ask were they see problems. Some mention UTF-8/16. I'm happy if someone tells me this is tricky and there is a working solution in library X or they would google for a solution that works with UTF-8/16.
'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”.'
[1] if stuck on modulo I usually suggest to assume there is a function divisible
How can you expect to be a professional software developer if you can't get some specs, then develop a solution?
If someone perceives "FizzBuzz" to be a "trick" question, he's exactly the kind of person FizzBuzz question should weed out as fast as possible.
The "trick" is the first hump - a goat.
Even a simple programming question can stump someone not trained in it. I've seen people who (supposedly) have computer science degrees fail on FizzBuzz.
In the end, it makes some sense to "talk shop" about programming issues. If they can't follow, it's probably not a good idea to hire them.
That being said, I'm assuming the failure mode we're discussing is 'flailing at the whiteboard and would never make any progress given infinite time' and not 'wrote an off-by-one error that a unit test would catch.'
fizz = 3
buzz = 5
both = 15
for i in range(1, 101):
if i == both:
print "FizzBuzz"
both += 15
fizz += 3
buzz += 5
elif i == fizz:
print "Fizz"
fizz += 3
elif i == buzz:
print "Buzz"
buzz += 5
else:
print istring reversing in place trick: stopping at the middle else it's an identity function.
Any time you spend with Fizzbuzz, you could spend it on more complete quizzes, discussing past experiences, taking references etc.
When I asked these kinds of questions I would execute the program in my head, and tell the candidate things like "your reverse() methods moves some stuff around, but the end result appears the same as before". Or "this fails with ArrayIndexOutOfBounds on line X". Typically it only took a few minutes to find the bug and fix it, and I learned about how the candidate solves problems.
Programming is all about abstraction. And fizzbuzz is an abstraction of a huge range of programming work.
Namely:
go through this data
pull out bits, based on these conditions
then do something with it
Some version of that underlies the vast majority of programming work.
They are the exact opposite. They are practical, very simple, introductory questions. Fizzbuzz is literally "do you know what a loop and a conditional are?".
On the one hand, I'm tempted to say everyone should be able to do that, on the other hand, they do feel like a type of programming that isn't super common in a lot of applications. FizzBuzz is probably a bit better in that regard.