I have been hosting a lot of technical interview by now, to determine whether applicants meet our programming and data understanding requirements. A lot of thoughts have gone into the structure and design of the questions to ensure that they tested all relevant aspects and where not 'gameable'.
Before I did my first I went online to find out what other people had done, and immediately came across "FizzBuzz". Then I realized that if I used something I had found online, my applicants might very well have studied for a technical interview and came across the same thing. Analyzing FizzBuzz I determined that it requires an applicant be familiar with at least loops and conditionals.
As it turns out we can use the same exercise to reach higher levels of programming skill. Here are a few variations I came up with to determine an applicants skill level. They are intended to be solved in C# or Java, but any Object Oriented language should present the same solution.
Level 0: Standard
Write a program that takes as input a number, N, and outputs all numbers from 0 to N. But if a number is divisible by 3 it instead outputs "Fizz", if it is divisible by 5 it instead outputs "Buzz". It it is divisible by both it outputs "FizzBuzz".
Level 1: Without iteration
Write the same program but without using while
, for
, streams, nor foreach
.
Level 2: Without conditional
Write the same program but without using if
, the ternary operator, nor switch
.
Level 3: Without either (almost)
Write the same program but using only one if
, no else
, ternary operator, switch
, while
, for
, streams, nor foreach
.
Level 4: Without either
Write the same program but without using if
, ternary operator, switch
, while
, for
, streams, nor foreach
.
Conclusion
Although the fact that level 4 is possible is a fun challenge, and shows creativity in an applicant. However, level 3 is much prettier, so I would seldom be disappointed if they stop here, unless creativity is very highly valued in the position they're applying for.
No comments:
Post a Comment