I read an interesting article on Coding Horrors about how 199 out of 200 applicants to become a programmer can't pass a simple test called the FizzBuzz Test. If you want to read the full article it is available here.
The FizzBuzz Test is a screening test that they put programmers through to test their potential. They are asked to write a simple program to meet the standards in as little of line of code as possible. The program must output the numbers 1 to 100 in order. However, any number that is a multiple of 3 must output the word "Fizz" instead of the number. Any number that is a multiple of 5 must output the word "Buzz" instead of the number. Likewise, any number that is a multiple of both 3 and 5, must output the word "FizzBuzz".
Any good programmer could do this in a variety of languages in under a couple minutes. However, the author of this article explains that "The majority of comp sci graduates can't. I've also seen
self-proclaimed senior programmers take more than 10-15 minutes to write
a solution."
Out of curiosity I tried this test and I finished it in under 5 minutes each in 2 different programming languages. I did it in VBScript and VB.Net because these are the 2 which are freshest in my mind.
My VBScript code matched the authors appearing like so:
Dim i
For i = 1 to 100
If (i Mod 3 = 0) And (i Mod 5 = 0) Then
WScript.Echo "FizzBuzz"
ElseIf (i Mod 3 = 0) Then
WScript.Echo "Fizz"
ElseIf (i Mod 5 = 0) Then
WScript.Echo "Buzz"
Else
Wscript.Echo i
End If
Next
My VB.Net Project contained nothing but a rich text box named "rtbOutput" and a Form_Load Event. The code was the following:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim i As Byte
i = 0
Do Until i = 100
i = i + 1
If (i Mod 3 = 0) And (i Mod 5 = 0) Then
rtbOutput.AppendText("FizzBuzz" & vbNewLine)
Else
If i Mod 3 = 0 Then
rtbOutput.AppendText("Fizz" & vbNewLine)
Else
If i Mod 5 = 0 Then
rtbOutput.AppendText("Buzz" & vbNewLine)
Else
rtbOutput.AppendText(i & vbNewLine)
End If
End If
End If
Loop
End Sub
Even though this test was ridiculously simple, I would still agree with the author that it is a very effect screening. I will probably continue to test myself with this as I move forward and learn more programming languages. I would love to hear your thoughts on this so be sure to comment. Also be sure to have a Merry Christmas!
If you have any ideas or suggestions you can comment below. Also don't
forget to follow this blog by becoming a subscribed member in the
sidebar. Lastly, if you want, you can receive blog updates via twitter
by becoming a member through your twitter account.
No comments:
Post a Comment