Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What question have you found especially valuable in interviewing software developers? What is it about the question that has made it particularly useful?

I'm looking for a particular question you like to ask, not just an interviewing approach like "make them write code".

share|improve this question

closed as not constructive by Adam Nov 6 '11 at 5:01

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

The question - as phrased - is not constructive, but has some good answers. Rephrase the question to match the best answers and I'll recommend that it gets reopened. – ChrisF Feb 14 '11 at 12:07

16 Answers 16

Take a look at this sample code and tell me how you'd improve it.

share|improve this answer
cough cough delete? – Craige Feb 15 '11 at 21:16

This is a bit specific to my scenario, but I think it was a great question, nonetheless:

So you say here that you've never touched C# or .NET before, right? Ok, so here's a workstation. Figure out how to write a program that queries this DB over here and prints a list of Customers with their orders, sorted by customer name. You can use whatever resource you want.

The only question I've ever had that actually tested my ability to learn.

share|improve this answer
Er, isn't this supposed to be a question you like to ask? – Paddyslacker Sep 6 '10 at 6:17
+1, this is a perfect question to ask. If they can't figure out basic language constructs with Google nothing will save them. – Josh K Sep 19 '10 at 10:36
Seems pointless, anyone can copy-paste crappy .net code straight from msdn. – dotjoe Apr 4 '11 at 23:51

This isn't a coding question, but a behavioural one:

Tell me of a time when you just couldn't complete all of your work on time to meet a deadline. What did you do? What was the result?

share|improve this answer
Why is this a good question? Seems pointless to me – Joe Philllips Sep 13 '10 at 4:50
The point is that from the developers answer I get a lot of information. Firstly, if they don't admit to this situation ever having happened to them, then they've either been fooling themselves, or they have no experience on real projects. Secondly, if they don't talk about how they'd communicate this problem to the team, but instead just talk about how hard they'd work to fix it, I don't want to hire them. Poor communication is responsible for most of the problems I see on projects. I want to hire proactive communicators. – Paddyslacker Sep 13 '10 at 7:06
I ask a similar, more general question ("tell me about a time when something went wrong, and what you did in response...") Very open-ended, and yet I had one interviewee swear up and down that nothing had ever gone wrong for him. Needless to say I did not recommend him for hire. – Alex Feinman Nov 3 '10 at 14:25

How did you get into programming?

Nice way to see if the person has a passion for programming and break the ice.

share|improve this answer

When interviewing somebody who claims to have a non-trivial amount of Java experience, I ask them about hashcode() and equals() and the relationship between them. It's not really possible to acquire significant Java experience without becoming aware of the potential pitfalls and anybody who is ignorant of the issue is going to be adding hard-to-find bugs to my project.

I'll also ask about ArrayList and LinkedList and the relative pros and cons. This should hopefully prove that they are at least aware of, and thinking about, the performance implications of the code they write.

I also like to get them to express an opinion on some technical topic (the usefulness or otherwise of Maven, checked vs. unchecked exceptions, etc.), and then play devil's advocate to see how well they can argue their point.

share|improve this answer

"What was the last (best) technical book you've read?"

or, more generally:

"How do you keep your knowledge up-to-date?"

It's amazing how many people never read a technical book since they finished school. And if you never read a book since you finished school and finished school ten years ago, you probably never heard about things like unit tests, design patterns, SOLID principles...

Response to comment:

You can downvote me if you like, but this is one of my favorite interview questions. Blogs, wikipedia, SO are all great sources for the latest high-tech news. But I don't think you can learn really complex subjects (like the stuff you find in Knuth's books) in full depth by reading blogs.

If I have to choose between two developers, where one shows this willingness to learn new complex subjects and the other doesn't, I'll hire the first one. Even if he or she wants more money. It'll pay off in the long run.

share|improve this answer
+1 You can learn a lot with online articles and blogs but even so, not reading technical books implies a lack of initiative and mediocrity too me. – Dunk Feb 15 '11 at 22:18

Reverse this linked list. Now do it in linear time. Now do it in linear time and constant space.

share|improve this answer
MyList.reverse() – Joe Philllips Sep 13 '10 at 4:51

Do you consider yourself to be a lucky person?

I read this in an interview of one of the founding members of Bruel & Kjaer and it struck a chord with me. Successful people are highly likely to consider themselves to be lucky. They see setbacks as opportunities to make improvements and tend to share their successes (luck) with people around them--Lucky people bring more luck.*

People who see themselves as unlucky are more likely to be a bad apple in your team.

* In this context, Luck should be read as preparation meeting opportunity, not a four-leaf clover.

share|improve this answer
+1 I'd like to upvote this several times more. – Slomojo Feb 15 '11 at 21:35

The one that's always worked for me...

"Tell me about your previous projects".

And then use their responses as a jumping point into asking them about their role in the projects and why they made certain decisions. Rather than making the interview into the SAT's, I just have a conversation with them. Thats always been more than sufficient to judge whether the developer was suited for a position.

I've only once been hired to a job where I already knew the language being used, so langauge specific questions dont have a lot of value for me. I also personally dont care much for syntax trivia (how would you do a cotton candy sort while trapped in a corral full of hungry Zebras?) and gotcha questions, so I never ask that sort of question.

share|improve this answer
If you could have any job in the world, what would it be?

I am only really looking for one thing: a serious attempt to answer it. The only wrong answer it so laugh and tell the interviewer that is the most cliche interview question in the world. (I voted no hire).

It is really a set up for my all time favorite question:

If you want to be [a Rock Star], why are you applying to be an [Internet Development Engineer III] here at [HugeCorp]?

It works best if they actually give some audacious answer. They rarely see it coming and this is only really an opportunity for someone to shine by saying something like "the hours here are better" or "my career here will last longer than the typical rock star."

I also lied about there being no wrong answer to the first question. Unless you are interviewing for some totally awesome dream job then the job they are interviewing for is the wrong answer. And if you are interviewing for the dream job and don't already have it, you should ask yourself why you aren't applying for it.

share|improve this answer
-1 I've turned down job offers from companies where people have asked stupid totally irrelevant questions like these. #1 It has nothing to do with the job or how you would perform #2 Rather than interviewing the person the interviewer is really trying to show how they are smarter than the interviewee by tricking them, and believe me their arrogance comes across quite strongly #3 I don't think I'd like to work with pr@#k$ that ask those types of questions at a job interview if I so disliked them in the interview. Asking the question over a beer, is another story. – Dunk Feb 15 '11 at 22:09

Doing c# interviews, I love asking, "How do you handle errors in a method"? If I get a decent answer to that question, I ask "How do/would you setup error handling in a web application?"

I'm always amazed at how many developers have no problem with the first question and no clue on the second. I've even interviewed many who couldn't describe how errors were being handled in their current project.

share|improve this answer

Something like this:

multiply a value by 7 without using *, / and + operations. :)

share|improve this answer
Does your codebase require knowledge of bit-twiddling or is it just to gauge interest in nitty-gritty details? – Peter Taylor Feb 15 '11 at 17:07
Note, he didn't say "or" – Ben L Feb 15 '11 at 21:12
@Ben, I think you just threw a logic bomb into the trapdoor - :/ – Slomojo Feb 15 '11 at 21:38
Isn't it just (x << 3) - x? – user13278 Feb 15 '11 at 22:55
Or even simpler: x -(-x) - (-x) -(-x) - (-x) -(-x) - (-x) – nikie Feb 16 '11 at 7:25

Similar to David's but slightly different:

Take a look at messy actual production code from an earlier version that we later fixed and improved. Tell me what it does. Tell me where the problems are (correctness and style). Tell me how you would fix and improve it.

This helps distinguish people who can just write new code, and people who can cope with the reality of legacy codebases.

share|improve this answer

many years ago I was asked the difference between the regexps /a*/ and /a*?/

I personally tend to ask a few questions about recursion.

share|improve this answer
Does the ? denote greedy or zero or one ? I've seen both syntaxes. – Paul Nathan Feb 15 '11 at 21:42
Which dialect?. – user1249 Feb 15 '11 at 22:08

I'm surprised at the number of failing answers to this question:

How would you search for an item in an unsorted list?

share|improve this answer

My favorite question is:

(Presumably in a mix of Java/C# and pseudocode)

Using non-exotic containers, design a class which would behave as a dictionary that is as performant as possible, which also allows you to enumerate over the keys not in "random" order but in the order these keys were added to the dictionary since it was first created.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.