Do you really have what it takes to develop software? I’m not talking about huge, multithreaded applications, but simply the ability to solve the most basic of problems.

For example, solve these:

  1. FizzBuzz
    Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
  2. Factorial
    Using recursion, write a function to compute the factorial value of an integer, n. Assume n >= 1.

Can you solve these without looking up the solutions? In under 5 minutes? If so, assuming you are a CS graduate, you are one of the 1 in 200 who can. This almost unbelievable number is reported by CodingHorror as an estimate of actual job interview results. If you are one of the 199 in 200 who cannot solve these, and are wanting to get a job as a developer, please start over or find another career.

Both of these problems are incredibly simple. However, they may be actual interview questions. Given the high failure rate, I’d say it’s definitely worth using these questions in an interview to quickly screen the wheat from the tares.

If you’re looking for the next level of possible interview questions, it’s worth taking a look at Stevey’s 5 Essential Phone-Screen Questions (a former Amazon engineer, with apparently plenty of experience). According to him, these are absolute, must-pass questions in order to move on in an interview (though they are closer to topics as opposed to questions):

1) Coding. The candidate has to write some simple code, with correct syntax, in C, C++, or Java.
2) OO design. The candidate has to define basic OO concepts, and come up with classes to model a simple problem.
3) Scripting and regexes. The candidate has to describe how to find the phone numbers in 50,000 HTML pages.
4) Data structures. The candidate has to demonstrate basic knowledge of the most common data structures.
5) Bits and bytes. The candidate has to answer simple questions about bits, bytes, and binary numbers.

A good familiarity with these concepts is a must. Even if you can’t write a perfect UNIX regular expression at this point in time, a grasp of regular expressions and why you would use them is important.

Some coding exercises from Stevey (to be solved in C, C++, or Java):

  1. Write a function to reverse a string.
  2. Write function to compute Nth fibonacci number.
  3. Print out the grade-school multiplication table up to 12×12
  4. Write a function that sums up integers from a text file, one int per line.
  5. Write function to print the odd numbers from 1 to 99.
  6. Find the largest int value in an int array.
  7. Format an RGB value (three 1-byte numbers) as a 6-digit hexadecimal string.

Stevey provides answers to these examples on his blog, if you are curious. He also lists important OO terminology (some of which sounded unfamiliar to me), important OO concepts, etc. He also stresses the importance of being familiar with several types of data structures, their big-O notation, examples of real-life uses for them, and why they are the data type of choice for that situation. It’s worth reviewing before actively seeking for a job or going into an interview.

I must admit that Stevey’s list covers a wide, but important, range of concepts. Study them, use them, write code both digitally and on paper, familiarize yourself with the terminology, and last but not least, know how to solve the idiotic, easy problems. When you are comfortable with all of it, you will definitely stand out above the crowd.

For those who are curious, I tried the ridiculously easy examples myself. Writing them both out on paper, the FizzBuzz solution took me about 2 minutes and the factorial solution took me under 1 minute. I am a junior software engineer with 1 year experience. Note: the factorial problem was not given on the CodingHorror blog, but rather was a specific solution that I provided to fill the “simple recursive problem” void.

Here is my code, for those who are unfamiliar with programming or would like to compare results. These are complete C# (C Sharp) programs, so you can run them yourself if you like. The actual relevant solutions are contained in Main() in the first example and Factorial() in the second. I chose C# because I have a program called Snippet Compiler handy, where it is very easy to code up simple solutions without having to create a full project.

using System;
 
public class MyClass
{
	public static void Main()
	{
		for(int i = 1; i <= 100; i  )
		{
			if(i % 3 == 0 && i % 5 == 0)
			{
				Console.WriteLine("FizzBuzz");
			}
			else if(i % 3 == 0)
			{
				Console.WriteLine("Fizz");
			}
			else if(i % 5 == 0)
			{
				Console.WriteLine("Buzz");
			}
			else
			{
				Console.WriteLine(i);
			}
		}
 
		// pause in order to see the results
		Console.Read();
	}
}



using System;
 
public class MyClass
{
	public static void Main()
	{
		string inputString = "";
		int input;
 
		while(inputString != "q")
		{
			Console.Write("Enter a number or 'q' to quit: ");
			inputString = Console.ReadLine();
			try
			{
				input = Int32.Parse(inputString);
				Console.WriteLine("{0}! = {1}", input, Factorial(input));
			}
			catch(Exception)
			{}
		}
	}
 
	static int Factorial(int n)
	{
		if(n == 1)
		{
			return n;
		}
		else
		{
			return (n * Factorial(n - 1));
		}
	}
}
Bookmark: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
  • Technorati
  • StumbleUpon
  • Fark
  • Furl
  • Netscape
  • YahooMyWeb
  • blinkbits
  • blogmarks
  • Spurl

Comments are closed.

Recent Posts

Most Popular Posts

Categories