Commonly Botched Interview Questions
30 Apr 2008Lately, I’ve had to do a some interviewing for new positions that have opened up here. My interview style is to not ask too many questions and to try and get the candidate to talk about themselves. Still, there a few technical questions I ask just to make sure the basics are understood. It’s surprising how candidates with many years of experience can’t answer the following:
- Define Inheritance - I think most candidates have a notion of what this is but manage to stumble around for 5 minutes or more answering it. What’s strange is that it can be described pretty much in one sentence. Answer: Defining new classes from existing classes.
- Define Polymorphism - I would love it if a candidate asked “Ad-hoc or Parametric?” But they never do. Again, I usually get a 5 minute answer that sort of approximates what I’m looking for. Often they define by example using the classic “Shape, Square, Triangle” example. Answer: Allows values of different data types to be handled using a uniform interface. Parametric Polymorphism is defining a type without mention of any specific type (also called generic programming). Ad-hoc Polymorphism - characterized by overloading (defining multiple methods with the same name but different types) and overriding (overriding or replacing existing code).
- Define Encapsulation - Again, I get a lot of hemming and hawing on this one often. Many candidates have a notion of what this is and try to define it by giving examples. It can be answered in a number of ways but mostly what I’m looking for is here is a mention of information hiding and separation of concerns.
- What’s the difference between malloc and new? - This is the easiest one of the bunch and it rarely gets answered correctly. Answer: malloc allocates memory from the heap, new allocates objects from the heap.
As you can see, there’s not much in the way of language specific stuff here. I’m more concerned with whether the concepts are in place. Good people will pick up new languages easily if the concepts are well understood. If the candidate misses these, it’s pretty much over from my perspective. By the way, we’re hiring…