Tuesday, January 19, 2010

Developer Interview question samples

FizzBuzz example.

A fizzbuzz is a small code sample/program that can be given to a developer to test his skills and knowledge about certain subjects


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1 {
public class ClassA {
public override string ToString() {
return "Hello from class A";
}
}

public class ClassB : ClassA {
public override string ToString() {
return "Hello from class B";
}
}

public class ClassC : ClassB {
public override string ToString() {
return "Hello from class C";
}
}

class Program {
static void Main(string[] args) {

ClassA first = new ClassC();
ClassC second = new ClassC();
ClassB third = (ClassB)second;
ClassA fourth = (ClassA)third;
object fifth = (object)fourth;

Console.WriteLine("1: " + first.ToString());
Console.WriteLine("2: " + second.ToString());
Console.WriteLine("3: " + third.ToString());
Console.WriteLine("4: " + fourth.ToString());
Console.WriteLine("5: " + fifth.ToString());
Console.ReadLine();
}


}
}