I routinely bomb the simplest interview quizzes. Usually the early "weed-out" ones like FizzBuzz. I do fine on the much more advanced questions.
I think part of what makes them more difficult for me is that they feel like a test. The more advanced questions, they feel like engineering problems in need of a solution. But when someone pops up with an out-of-nowhere "do this purpose-less thing!" question, I spend all of my time wondering about what they're actually looking for, and none thinking about the problem at hand. Is this a trick? Am I missing something? What does he want from me!?
I also just can't code worth a damn when someone is staring at me. I love interviewers who pose a long, complicated question and then leave the room for 30 minutes so I can work on it. These are always much more difficult problems, and I find them infinitely easier than the little 2-minute quizzes.
Our company has recently started doing (developer) screening by doing online real time coding, where the candidate get the opportunity to solve some real-time problems in their vertical, with whatever tools/compilers they are comfortable with (Java/Python/C/C++ and MAC Layer, PHY Layer, SQL, UI Frameworks, etc..) before they are brought in for an interview.
Nobody fails fizzbuzz in our interviews, and it means nobody is wasting interviewing time doing screening anymore.
As an example i'm working on a largish codebase (100,000 lines) right now now and a quick grep shows only 4 uses of it, all of which are in a jQuery plugin.
my $i;
my $fizz = 3;
my $buzz = 5;
for ($i = 1; $i <= 100; $i++) {
if ($i ne $fizz && $i ne $buzz) {
print "$i\n";
next;
}
if ($i eq $fizz) {
print "fizz";
$fizz += 3;
}
if ($i eq $buzz) {
print "buzz";
$buzz += 5;
}
print "\n";
}
Edit for formattingAnd because I had to fiddle around manually to understand it (not good at Ruby's inbuilt methods) here's how it works: It generates two long arrays, one containing "Fizz" every third element, and one containing "Buzz" every five elements, the rest is filled up with nils.
Then it iterates over 1 to 100 and zips the two arrays at that position together - if the "zipped together" sum of both arrays is nil, that number is printed, else the concatenated string of both arrays at that position is printed (example: "Fizz" + nil = "Fizz"). Neat!
Edit: I also found a great one using flip-flops: https://gist.github.com/3230984
That said, I guess I should rephrase my question: Is there a simple programming test that can help weed out fakers quickly, which does not involve mathematics? Sort of like "Deploy a simple CRUD app in 15 mins" or something?
This is to address the parent's concern that a lot of web apps out there don't actually require much mathematics.
''.join(filter(None, [a, b]))
and
itertools.cycle([None, None, 'Fizz'])
itertools.cycle([None, None, None, None, 'Buzz'])
Note: Thats not to say that that all people with people skills can't do fizzbuzz, just the people with an abundance of it. Why waste time getting good at a hard skill, if you can get by perfectly fine with your great soft skills?
It's a shame people can't get it. But modulus is an operation I do daily.
The thing is you can get quite far in programming using that approach.