On C# Technical Interviews for Senior Roles
I am doing preliminary interviews for some Senior C# Developer roles. I usually ask lots of questions, but I don’t expect the candidates to answer them all. However there are a few questions which are deal breakers in case they are not answered correctly. These questions are quite simple, though fundamental. The candidates who cannot answer these questions, leave a bad impression on me. Quite surprisingly my acceptance ratio is as low as 5%. Which is a bit low, given that most of the candidates I interview have:
- At least 5 years of programming experience.
- Good related academic degree.
- A CV full of buzz words and success stories.
I’m going to briefly address these questions here. Hopefully they can be good starting point for learning C# in more depth.
Object Oriented design basics
Everybody knows inheritance, but it seems that not many people know why it’s not a very good idea most of the times. I’m talking about “Composition over inheritance” rule. This is a basic rule in designing object oriented programs, but it seems not many people cares about it.
It’s a very difficult topic to master. It is even harder to question it over the phone. But I expect my future colleague to know what a Task is. Not only because it is much easier to work with than threads, but because:
- It’s been part of the framework for quite a long time. If you don’t know it by now, chances are that you are not a good fit.
- Newer features of C# language (Async/Await) are tightly related to it.
C# syntax and conventions
Using is an essential statement in C#. Using ‘IDisposable’s correctly is a must in any type of application, and ‘Using’ makes it easier to handle ‘IDisposable’s through a simple syntactic sugar. If somebody doesn’t know about these two, chances are they are not up for a senior role.
I lost my faith on this already, developers don’t know many design patterns, I accepted that long time ago. Asking candidates what is this pattern and what is that pattern usually doesn’t work, since everyone just know a few patterns. I usually let the candidate to pick the design pattern he wants to describe, as long as it is not singleton. But the interesting part of their explanation is the way that they describe the problem that the design pattern solves. Because I believe the problem is as important as the solution.
Asking algorithmic questions over the phone is tricky. But I believe anyone should be able to describe an algorithm that finds the most repeated word in a list of strings.
Not that it is a very simple algorithm that can be described over the phone, it can show other things about how candidate really thinks about a problem:
- This can be done in O(n) using a dictionary. If the candidate doesn’t use a dictionary, chances are that he is not very knowledgeable about collections.
- This can be solved by a simple lambda GroupBy. Linq and lambda were parts of the framework for ages now. Not knowing them is not a good sign.
- Since group by is used in relational databases very often, it can show candidate’s SQL proficiency to some extent.
Asking about internals of garbage collector seems to be a trend these days, and of course candidates are prepared for these type of questions. Most candidates know that after GC got rid of unused objects, the surviving objects should be moved to the next generation. The question is whether there are reserved areas in the memory for each generation, so GC has to move objects from area that is reserved for generation 1 to the area of generation 2.
Nonetheless that the answer to this question is just a loud laughter, I accept that this is a tricky question, and I’m not really looking to hear the correct answer. But hearing fairy tales about how memory is managed by CLR is a red flag.