Posted 03.28.05 in Technology
Technology

Having gone through the interview process a few times as a recent grad I wanted to write down some general hints and tips about the interview process. Aside from your skill set, I feel that employers are looking for the same thing that you are looking when you go clubbing, to meet someone whom you have chemistry with. You might hear interviewing manager call this chemistry the "right fit." So fit right in and take a look at my experience through the interview process.

What is the difference between an interface and an abstract class?

This question tries to determine if you are familiar with simple programming language features and the difference between them. I have found this question to be really common in Java shops. This question might even be common if you are interviewing for a C# developer position. There are other alternatives to the interface question, such as what is the difference between an interface and an object. I prefer outside-the-box questions such as the following: What is difference and similarities between a class and a blueprint? What feature would you add to your favorite IDE? What would you improve in the Java language and why? What is the difference and similarities between a design pattern and a pile of bricks?

What is reflection and describe a case where you would use it?

If you are doing Java or C# you might get a question about reflection. But you can also experiment with reflection in other languages such as Ruby. The here is that you can discover metadata about classes and objects with a reflections API. For example, a easy thing to do with reflection is to discover all public methods.

How do you reverse a String object? How do you reverse an Array?

In the interview process, once you are done with language specific question then you get the whiteboard pseudocode questions. For this question, how to reverse a string, you will most likely be asked to go up to a whiteboard and write some pseudocode to reverse a String object. I recommend that you describe every step of the code to the interviewer as you are hacking it out. Also try to write legibly.

Here is one implementation of the reverse string code:

public String reverseString(String str) {
    char[] chars = new char[str.length()];
    for(int i=0; i < str.length(); i++) {
        chars[i] = str.charAt(str.length()-1-i);
    }
    return new String(chars);
}

How would you implement a link list?

I have found this question to be very popular, especially for new grads. A link list is a chain of nodes; each node has a reference to the next node in the list. To implement a link list you will define a node class and a link list class. The node class has an Object reference to store the users' data inside the node. The node also has a reference to the next element in the list. Here is sample code for a link list:

Node {
    Object data;
    Node next;
    
    Node(Object data, Node next) {
        this.data = data;
        this.next = next;
    }
}

The link list class will manage a collection of node objects by having a single node reference, the head of the list. When the user wants to add data to the link list, the link list will create a node object to wrap the data and add this new node to the last node entry in the list.

public class LinkedList {
    private Node head;
    
    public LinkList() {}
    
    public void add(Object data) {
        Node end = head;
        while(end != null) {
            end = end.next;
        }
        
        Node n = new Node(data, null);
        end.next = n;
    }
}

Given an array of String objects, how do you sort them?

Again, if you are a recent grad you will most likely be given a sort question. Sort an array of integers. Sort an array of String objects. During the years that I have worked as a Software Engineer I never had to write a sorting algorithm. But because sorting algorithms are such textbook examples they make a good interview questions. This is a good interview question not because you can prove your creativity by sorting an array of but because it is such a textbook answer that interviewers can compare you answer against any data structure and algorithm book. I recommend that you be familiar with at least the familiar with the selection and quick sort algorithms. I suggest these two algorithms because they are both under twenty lines of code and represent O(n^2) and O(n log n) algorithms, respectively.

Sort using Java's built in sort capabilities:

public String[] sortStrings(String[] toSort) {
    List sort = Arrays.asList(toSort);
    Collections.sort(sort);
    // You can also use Arrays.sort        
    return (String[])sort.toArray();
}

If you have to write out the sort algorithm yourself, here is a simple sort using two for loops. You might want to mention that this method is a big-oh n squared, O(n^2):

public String[] sortStringsF(String[] toSort) {
    int lowest = -1;
    for(int i=0; i < toSort.length; i++) {
        // Assume my starting point is the lowest value
        lowest = i;
        
        // Find the lowest comparable value
        for(int j=i+1; j < toSort.length; j++) {
            if(toSort[lowest].compareTo(toSort[j]) > 0) {
                // New lowest
                lowest = j;
            }
        }
        
        // Swap the slowest value with current position
        String swap = toSort[i];
        toSort[i] = toSort[lowest];
        toSort[lowest] = swap;
    }
    return toSort;   
}

Given an employee database table with a salary column, how do you select the top five earning employees?

Usually when I get a database question like this the first thing I ask is "For what vendor?" Database vendors have discovered that there is more than one way to do a thing and this is true for limiting the rows return in a query, procedures, and other database features. Be sure to know SQL, especially if you put it in your resume. SQL is widely used from simple web apps that baby sit a database to large enterprise applications.

Explain a database to a young child and explain the Internet to your grandparents?

The "explain the internet to your grandparents" question will soon be outdated. In a decade or two ninety percent of the grandparents, which in some case will be one of us, will have grown with the internet. But I am sure there will be new technologies we would need our grandkids to explain to us, such as cell phone implants.

Describe OOAD, XSD, AOP, SOAP, XSLT, OOP, RUP, DTD, XML, SOA, AND, JOO, MAMA?

Doctors have to remember a bunch of words and terms derived from Latin and Greek. Techies speak in acronyms. There are so many acronym technologies that it is hard for a professional to keep track of them all. I mean, even a common consumer products such as a modem and RAM are acronyms. Be prepared to describe an acronym in plain English so as to demonstrate you communications skills. If you put down an acronym down on you're resume be ready to explain what it means. I have found that when you are asked to explain an acronym the interviewer is testing your communications skills or simply because they themselves don't know what SOB means.

In closing, here is some general advice about the interview process. Bring an energy bar or something to snack on between breaks in order to keep your energy level up. Bring a bottle of water and keep it filled up. Interact with the interviewer. Ask questions, think out loud, etc. Expect coding questions if you're a dev, testing questions if you're a tester and passion questions no matter what. Don't forget to smile.

One of my favorite quotes regarding the interview process comes from Bram Cohen the inventor of BitTorrent. Bram says "Even though work history doesn't correlate with job performance, being a lying sack of shit almost certainly does."

Powered by Juixe PAX. xhtml 1.0 trans/CSS.