Greg Beech's Website

Technical interview questions for software engineers

There are loads of interview questions on the web, but most are just a list of "do you know this" type questions focusing on things that any moderately capable developer ought to know. I'm in the frame to do some interviewing for blinkBox over the next few weeks, and we don't want to hire moderately capable developers, we want to hire the best software engineers.

What's the difference between a developer and a software engineer you might ask? Well a developer is a grunt who given a set of requirements can build a functional component or application. A software engineer can help to build a specification, work to that specification, work as a team, present their ideas either verbally or in writing, track work items and issues, manage continuous integration, create deployment scripts, and all the other things needed to create enterprise class applications. A good software engineer will also understand the platform they're building on so they can make appropriate design choices based on network latency, garbage collector impact, thread pool utilisation and so on.

So here's a bunch of questions which are quite varied and can help to determine whether someone is a great software engineer - it's not a comprehensive list, more a guide to help you structure an interview. If you think you can answer most of these questions and talk around similar subjects, and that you'd work well with a team of highly capable software engineers in a friendly and dynamic environment, then check out our jobs page.

Whiteboard coding

Coding on the whiteboard is a great way to assess whether someone has reasonable problem solving skills, and can keep their head under pressure. Typically interviewers aren't looking for code that will compile perfectly as it's pretty hard to write this without an actual compiler, but are looking for the approach you take. For example, do you clarify any assumptions about the problem, do you think about it before starting to code, do you work through it in your head to prove it is correct, and do you actually have confidence you have got the answer right?

If you're doing the interviewing and somebody gets stuck with a problem, then provide hints to help them along the way. In addition, I tend to ask people how they would test the method, including checking for errors and edge cases. So, without further ado, here are some ideas for whiteboard coding questions:

1a. Write a method that takes an array of characters and reverses them in place.

1b. Extend the previous method to take an array representing a sentence and reverse each word in the sentence.

2. Write a method that multiplies two integers together without using multiply or divide operators.

3. Write a method that removes an item from an arbitrary position within an array.

4a. Write a method that will remove all duplicates from an array.

4b. How could the previous method be made more efficient if the array was sorted?

5. Given a set of two-dimensional coordinates, find the one nearest to a target coordinate.

Design questions

Undoubtedly on recent or current projects you will have had design sessions where you make decisions about how components and APIs will look, and where you decide how the UI, service and data tiers (or whatever tiers you have) will talk to each other. I like to ask design questions that have already been covered, or are currently being considered, to see whether the candidate thinks in a similar way to existing people on the team. By "in a similar way" I don't mean whether they have the same ideas - different ideas are equally valid - I mean whether the consider the same sort of issues and compromises when formulating their answer. Here are some examples:

1. The service tier is currently used in-process by the UI tier, however it needs to cater for both web and mobile-web UI tiers, and in the future we may want to expose it via WCF services to allow external systems to utilise it. How would these requirements affect the way you design the public service API?

2. As well as performing individual operations on the database, we need to perform bulk operations involving many of the same type of individual operation. How would this affect your design of the database stored procedure API? What are the relative merits of the possible approaches here?

In addition to specific questions about the application platform, depending on the role of the person you might want to ask some questions about design patterns. You may not be using them, but if you don't even know about them then you can't evaluate whether you should.

1. Do you think that test driven development is a valid methodology? How can you use inversion of control patterns to facilitate test driven development? How can mock objects be used to speed up testing and development?

2. What is an ACID transaction and why is it important? What is a long running transaction and when would one be used? Should transactional semantics be controlled within a database, or from a higher level in a services layer? What are the advantages and disadvantages of each approach?

Knowledge questions

As I hinted at in the opening paragraph, I don't tend to ask questions which I expect people to either know or be able to look up on a search engine in about thirty seconds. Every day I spend quite a while looking things up, and there's no shame in that - the .NET framework is far too large for any one person to have a comprehensive knowledge of. However, there are certain underlying principles which you need to know to guide your development practices. For example, just because we no longer deal with direct memory management, you can't write efficient applications unless you understand the difference between the stack and the heap, and how the garbage collector works. These are some of the areas I'll typically discuss:

1a. What is the difference between the stack and the heap? Are structs always allocated on the stack or can they be allocated on the heap?

1b. How does the garbage collector work? How does it use generations to improve performance? Are there any problems with long-running garbage collected applications?

2a. What is type polymorphism and what is it used for? What is covariance, and why is it important in .NET 2.0?

2b. When would you use interfaces to implement polymorphism, and when would you use abstract base classes?

3a. Why are thread pools used? How would you decide whether to use a thread pool or create a thread manually?

3b. What are some of the features of .NET that allow you to implement asynchronous programming without manual threading?


Posted Jul 30 2007, 11:05 PM by Greg Beech
Filed under:

Comments

Peter Ritchie wrote re: Technical interview questions for software engineers
on 08-13-2007 1:26 AM

I usually ask candidates questions that suggest they know about a shovel but don't know that it can dig them a deep hole that is difficult to get out of.  In my C++ days I'd show candidates a class with a non virtual d'tor (and some other minor problems) and ask them how they'd change it. On it's own it wouldn't be reason not to hire the person; but in conjunction with all the other questions, gives me an idea where I could place them if I hire them (I don't interview someone unless I'm willing the hire them based on their CV).  Extending to C#, I tend to ask questions about areas of the language that can get them in trouble, like implicit converters, value types (and lack of Equals, operators), threading, etc...   It gives me an idea of the depth of knowledge.  The string reversal is a classic Joel interview question, but doesn't really tell me much other than they can write code I'll never need (or that they read Joel and studied for the interview).

I look for people who can write really good code, can design really stable software, and will hunt and destroy bad code.  Showing them a C++ class with a non virtual d'tor, a C# value type without Equals/equality operator, or calling a virtual method from a c'tor, along with several other questions, will tell me they now what they're talking about and will probably make the existing code better.

I've met a large number of programmers that were good with language syntax (broad knowledge) but tended to write buggy code that was high maintenance (didn't have a depth to their knowledge).

Saying that, of the 5 or 6 dozen interviews that I've been on the receiving end of (where I'm the interviewee) I've only been asked to write code twice; once was whiteboard and once was laptop.  I've also had a couple of "Final exam" interviews there they give me 5-6 sheets of questions and ask me to answer them all...

Your Knowledge questions are definite keepers though; anyone can learn syntax, if a candidate can answer the Knowledge questions, they "understand".

Matthew Taylor wrote re: Technical interview questions for software engineers
on 06-13-2008 11:01 AM

How are these questions going to ensure that candidate would be productive and not just book worm.

These questions aren't intended to check whether a person would be productive, they're to check whether we would want them to be productive in the first place (the worst possible scenario is to have somebody who is productive but doesn't know what they're doing, so they write a large amount of poor code).

Apart from this type of question, I'll also ask about projects they have worked on in the past, and look for examples of projects they have actually shipped (or failed to ship, which can be just as valid and interesting as long as they learned from it). That said, I think it's quite hard to determine whether somebody will be productive from an interview; you need to rely on your instincts. - Greg

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Enter the numbers above:
Copyright (C) Greg Beech. All rights reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems