4 ms·
I like the problem of printing the leap years (or deciding if a year is leap). It's the same as FizzBuzz in the core (though a bit more complicated), but presen
by rplnt 14y ago
I like the problem of printing the leap years (or deciding if a year is leap). It's the same as FizzBuzz in the core (though a bit more complicated), but presents itself as something real, not like an artificial task. And as a bonus, you can see if the applicant knows the rules for inserting leap years (there are no negative points for not knowing that, only positive if you do).
- modernerd 14y agoThe trouble with more practical tests like this is that good languages are already full of practical methods. e.g. Ruby: Date.leap?(2000) # => true So you might inadvertently end up testing a candidate's knowledge of their language's standard libraries, unless you forbid them from using these. I suspect that's why more artificial tasks like FizzBuzz are still popular.
- hga 14y agoIsn't this the point where you congratulate the interviewee on the breadth of their off the top of their head Ruby knowledge ... and then ask them to do it by hand? Surely the latter won't be a surprise; if I answered like that I'd do it with a grin and a "Well, I could do it like this [write out the above], but I suspect you want something more like this [then write an implementation of the method]."