4 ms·
How is Fizzbuzz a trick question?
by ckuehne 10y ago
How is Fizzbuzz a trick question?
- kefka 10y agoTo someone who can't do it, it is a trick question. The "trick" is the first hump - a goat.
- p0nce 10y agoargumentum ad hominem (edit: was never asked to do Fizzbuzz)
- kefka 10y agoNot at all. 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.
- p0nce 10y agoFrom this thread you'll find people that will reject someone with 10 years of experience because of failing Fizzbuzz in the conditions of an interview. It's not always used to talk shop. What I say is that there are things that are probably more statistically significant that questions with gotchas.
- HeyLaughingBoy 10y agoSo? I've interviewed people with graduate Computer Science degrees who couldn't program a for {...} loop. Blew my mind, but it happened enough times that it doesn't surprise me any more.
- pbh101 10y agoGoing to echo this sentiment: I think the only way FizzBuzz is a trick question is if you aren't familiar with the modulus operator, in which case I think it fair to say you haven't spent much time programming. 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.'
- mrob 10y agoEven if you've never heard of the modulus operator, it's still easy, eg in Python: 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 i
- woofyman 10y agoIf you can't write your own modulo function if don't understand the fundamentals of integer/floating point operations. Or are unaware of ceil and floor functions.
- p0nce 10y agoFizzbuzz trick: you have to make a special case for modulo 15, you can't reuse the 3 and 5 cases. string 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.
- QuercusMax 10y agoAnd if the candidate trips up, this gives you an opportunity to walk through a virtual compile-debug-test cycle. 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.