views:

5334

answers:

56

What single question, more than any other, enables you to sort the wheat from the chaff when interviewing developers?

A: 

Tell me about yourself.

Ben Hoffstein
I'm a 36-24-34 blonde with blue eyes :-)
Cristian Ciupitu
A: 

I ask "Why are you here ?"

pgras
That's rather philosophical.
Ben Hoffstein
Aren't you supposed to ask "Who are you?" first? :)
Mike
That seems like an easy one?
Zach
I'm here for the interview, chief! :)
s t
I like this one.Its designed to test is the candidate can understand user requirements. He asks "Why are you here?" but he means "Why do you want this job?"
Dave Turvey
To have a cup of coffee.
Ravi
+24  A: 

What do you do to improve yourself as a programmer, so that you do not feel stagnated, to make sure that your programming skills are always up to date?

answer: Find an employer who believes in training their staff?
John
Is there any good answer to this, not tell in interview but to use ;)
metdos
A: 

If they are interviewing for a .Net job, ask them about the favorite episode of .Net Rocks. If they can't answer you with a few that they really love, then ask them if they have any questions for you and politely say goodbye.

Ask them what they think of stackoverflow.com. If they don't have any opinion on it, then the interview is over.

Ok, so these are a little too simplified. But you should really seek questions that aren't loaded like mine above to let them show you how passionate they are about software, or frankly life in general. Most passionate programmers are just as passionate about other things as well. Ask them what they like besides coding.

Charles Graham
There are way too many great programmers out there who don't know what .Net Rocks or StackOverflow.com is.
Christian Davén
Well, I would say that theere aren't that many, although it took me a long time to find them myself. However, you should read my WHOLE COMMENT.
Charles Graham
DNR is -way- too web-based.
TraumaPony
The web is where -most- developers develope in these days. But they have done a lot of stuff on WPF, which is the new client server technology, and most of the shows are about programming in general so I don't know what they heck you are talking about.
Charles Graham
I stand corrected. Out of the past 50 episodes of DNR, a wopping 5 of them were about web specific technologies.
Charles Graham
+8  A: 

How do you recognize a great programmer?

Ben Hoffstein
+18  A: 

If you could add one feature to your favorite programming language, what would it be?

Ben Hoffstein
_If_? You're not using lisp, are you?
nilamo
+5  A: 

Ask a question based on an answer that has just been given.

Paul Rowland
+7  A: 

Show them a really simple code example, with a bit of inheritance involved, and ask them to explain it, line-by-line.

metao
I've given people I've interviewed a simple - and deliberately full of bugs - PHP script of a 'guest book', and asked them to say what is wrong with it. No one has impressed me with their answers though.
Alister Bulman
thats too complicated. you want something stupidly simple, but with a couple of trivial gotchas. you basically rate people based on what the know, what they guess, what they catch and what they deduce.
metao
A: 

What is your main intention to join this job in our company.

balaweblog
+32  A: 

For a programming job, the best technique is to ask the candidate to solve a simple algorithm in a white/black board.

or a little 30 min problem..
Gishu
like FizzBuzz! (do not put your version here....)
Alister Bulman
From a candidate's point of view, I would feel inconvenienced by the whiteboard's poor editing features and unclear font ;-)
Hugh Allen
@Hugh Allen you can only blame yourself for the font :P
Ólafur Waage
I find the use of algorithms as a screening tool pointless. For most dev jobs, the ability to abstract or build sensible class hierarchies is way more important.
Uri
A focus on algorithms can get you the people who are math/CS purists who have zero instinct when it come to sensible engineering practices. Depending on what your company does, it may be a good or bad idea. If your candidate passes the engineering part, make sure he understands his big O.
Uri
From a candidate's point of view, I would be turned off by the lack of version control on said whiteboard.
Arafangion
@Uri - I suppose you haven't read the FizzBuzz "buzz" from Jeff (try saying that ten times fast). A lot of applicants don't know how to code, apparently. So just having SOMETHING to filter them out saves you a lot of time.
Tor Valamo
@Tor: Calling FizzBuzz an algorithm would be an insult to algorithm, IMHO. And either way, if you invited someone onsite and they can't do FizzBuzz, you need to revise your resume screening and phone interviewing process.
Uri
@Uri - I'm not saying you need to use FizzBuzz, I just mentioned it to reference the Coding Horror blog.
Tor Valamo
@Tom: I understand. I've used it in interviews myself, but mostly when trying to gauge the programming potential of QA manual testers. But I've had interviews were I was asked crazy algo questions, where I felt an evaluation of programming skills would work better. Either way, Fizz Buzz is more about programming than anything else.
Uri
+32  A: 

One that I ask is: Who do you admire from our industry?

Many candidates, the typical its-just-a-job non-passionate programmers, cannot give even one name. Not even 'Bill Gates'.

Sad.


Edit, after receiving comments:

I completely agree with the fact t one doesn't have to admire someone to acknowledge that his/her work is valuable to the industry. So I think the question that best represents what I was trying to ask the candidates is:

Mention the name of one of the influential people in our industry.

If they cannot given even one name, that doesn't tell me much about their ability to code, but definitely affects my decision more than a technical question answered incorrectly.

Sergio Acosta
That ... is a great question. I'll be asking it in my next interview.
To me it seems odd that you must have a certain person or company as inspiration to be a good programmer.
Christian P.
@Christian P: I am certainly not expecting the candidate to have a specific or unique 'inspiration'. I just expect they **know** some names from our industry. The sad thing is, according to my experience, that many can't even recall one name.
Sergio Acosta
J.F. Sebastian
I don't know. Name dropping correlates to success in the large, but name dropping definitely doesn't mean anything about coding!
Overflown
For the naysayers: so if you were a football club manager, you'd hire a footballer who couldn't name a single famous footballer?!
Benjol
If someone asked me this there are a few different answers I could give and in a sense it would reveal a good deal about myself if the question is intended to have a, "Why do you admire her or him?" follow-up as it has shifted over the years but I do know a few people that I would put on that list in terms of influencing how I view the world or change what I do.
JB King
I can only think of 3 famous proper software people... Gates, Stallman and Torvalds. And two of them I think are arrogant idiots :) I love programming but I don't know any famous programmers, because programming isn't _like_ football.
John
++J.F. Sebastian. I think it would be better to ask "What do you admire about our industry?" Or at least use this after using the original question if the interviewee cannot find a name. If he cannot even answer this, then you may have a dud in the enthusiasm department.
trinithis
A: 

Spout off a couple of acronyms and ask them what they think.

Make sure that you phrase the question as if Michael Scott from The Office was the interviewer.

Remember that it is important to say S.E.O. and not Search Engine Optimization. Also, an incorrect contextual use of the acronym is key.

For instance, "If you were to approach our private secure intranet from an SEO perspective, what programming language would you choose to improve our ROI in Google Adwords?"

Since it is unlikely that the private intranet is being crawled by Google, the question doesn't make a lot of sense. If they can patiently explain, without being arrogant, why the question makes no sense -- and if they ask reasonable questions to figure out the problem that you are trying to solve, then it is time to start asking them actual questions about programming.

Timothy Lee Russell
Remember the interviewer is on trial too. If I was asked this question I wouldn't be coming back for a second interview.
John Nolan
That's certainly a fair criticism of the question.
Timothy Lee Russell
I don't know why this answer was modded down. What a clever way to test your candidate's interpersonal skills!
dysfunctor
pretending to be clueless may help you weed out the losers, but it might also scare away the superstars.
Mark Bessey
-1. If an interviewer tried to pull something like that on me, I wouldn't be back. Remember, you're the one that's hiring. You NEED good people. And good people, generally, have a fairly low tolerance for bull.
Matt Grande
Businesses need people who have a sense of humor and the ability to skillfully navigate situations with an unknown exit strategy.In my opinion, technical skills can be taught more easily than interpersonal skills and this type of question effectively addresses how a person will react in a common business situation.If an interviewee can't handle this question with grace, then despite their massive brain and superhuman programming skill, they may not be a good fit for your company.
Timothy Lee Russell
If you think to yourself when being asked this question, I'm the best programmer on earth and this question is stupid, you may be the type of person this question is intended to weed out.
Timothy Lee Russell
+10  A: 

Interview for a php dev.

$x = array( 1 => 2 , 2=> 3 );
foreach( $x as $i => $v )
{ 
    print "\$x $i is $v\n";
}

It may look trivial, but if they can't tell you what that gives out ( if they can't even be in the right ballpark ) they have not really used php, and are "chaff". It doesn't mean they're good, but failing that?

Reason being, that 3 lines of code summaries almost 90% of php code.

If you can't use arrays, loops and printing, you're not getting anywhere fast :)

Kent Fredric
you ask them to write this? or to annotate it... I guess the trick here is what does ( as $i => $v ) do
Brian G
Is it this?$x 1 is 2$x 2 is 3I've never done PHP. I can has job? :)
JavadocMD
@CynicalTyler yes it is.
mrinject
Evil interviewer could swap $i and $v to check bug-spotting abilities of the candidate.
J.F. Sebastian
whoa, i just started reading php yesterday and i know it. lol you really need to ask something else
Sujoy
@Sujoy: 95% of applicants fail that test, ie: people write "php" on their CV when they've never used it IN THEIR LIFE!
Kent Fredric
A: 

Ask them to make a simple "Hello World" program.

Then ask them to establish a database connection and make a simple SQL statment from that database.

Most of them were stumped at second step.

I can't remember the syntax to establish a database connection. The actual code to create the connection is usually going to be written *once* in any given project. An SQL statement is a different story.
Adam Jaskiewicz
Agreed – I don't care if someone can remember how to establish a DB connection. Maybe, though, it would be useful to see if they error check it properly?
David Wolever
+1  A: 

Recursive factorial. doesn't tell if a person knows about a language, but contains enough problem to be discussed to test if the implementor knows what is doing in programming terms. I put this just at start of the interview, to separate early between programmers and experienced copy pasters.

Lorenzo Boccaccia
+4  A: 

Where is your favourite online source of technical information? With a followup of discussing whether the single word "Google" is a reasonable answer to the first question.

Everyone (should) have a favourite, trusted source - obviously SO is quickly becoming that for all of us - and be able to outline why it is their choice. Being able to make that explanation well - and then to reason through the power and pitfalls of the Google search - is a good sign of an analytical mind.

There are two types of knowledge in this world, that which we think we remember well and that which we know how to find.

Unsliced
Could you name a single online source of technical information which is even comparable to "Google"? http://stackoverflow.com/questions/155461/could-you-name-a-single-online-source-of-technical-information-which-is-compara
J.F. Sebastian
+1  A: 

Write a program, that tells how many numbers from 1 to 100 are not dividable by 3?

Can be in pseudo-code, or BASIC/PHP/C or whatever the candidate feels confortable with (But not brainf*ck :-)). Simple Example:

count = 0
foreach i in 1 to 100
    if i % 3==0
        count = count + 1
print 100-count

Wrong:

Floor(100/3)

Because the question was: ... are not dividable...

Correct:

100-Floor(100/3)

This show very fast if any programming skills are available.... and how good they are :-)

Andre Bossard
Wouldn't that be 100 / 3, also for any number you substitute for 100?
Martin Probst
Nice trick question
Brian G
I think it is 100- Floor(100/3) instead of 100-Floor(100/33)
amadamala
it's not intended as a trick question. Personally if the candidate overreads the *not*, I tell him that and the reaction is also very interesting.
Andre Bossard
> This show very fast if any programming skills are available....I don't see how. It's a question of "can I realize that this is a math problem and not a computer science problem."
Jake
@Jake: What exactly is your math problem with deciding if a number is dividable by 3? And doing that with the numbers from 1 to 100?
Andre Bossard
Every number is *divisible* by 3.
hobodave
+3  A: 

What open source projects have they participated in?

Matt Lacey
Is this a make or breaker? Would you not hire someone just because they didn't contribute to an open source project?
John Nolan
It's not a critical question but I thought it was worth including in this list. If someone has contributed to open source projects you want to make sure to talk about it in the interview.The relevance of this question depends on the job and the technologies used.
Matt Lacey
What do you do when they say "none"? What if they don't really buy into OS? Would you not hire someone for this reason? Seems to me like a way to get into an argument over OS or become buddies over hating MS... both cloud your objectivity.
John
If they say "none" you ask why. Do they use it but not contribute? Do they just stay away from it entirely? I feel it's definitely a subject to consider in a technical/developer interview.Open Source isn't the alternative to Microsoft. There are lots of Open Source projects which run on the Microsoft stack. If you get into an argument in an interview it's a definite 'no hire'. If you're going in into an interview looking for an argument then you shouldn't be interviewing.
Matt Lacey
+24  A: 

Ask about a recent project, the candidate's contribution, and then dive a little into the technique. This will quickly reveal 1) if the candidate really understood what he or she was doing or merely copied/borrowed some existing piece of code, 2) if the candidate can explain his or her work to others.

Emile
While i agree this is effective, i have found that this becomes really time consuming especially if you enounter talkers.
This is a good way of separating out the designers who think abstractly. People who draw UI screens are an alarm bell for me. Unless they're UI designers of course :-).
Bob Moore
A: 

Someone applying for a coding job needs to be able to write code. Ask them to solve a basic algorithmic problem in whatever language they'll be using on the job.

I usually have them reverse a NULL-terminated string in place, or reverse a singly-linked list, in C. It's a pretty trivial problem, but it's quite astounding to me how many people fail at this.

I have many data points, and the results are nearly 10%: people who can solve one of these problems quickly (in 5 minutes or less) will turn out to be good programmers. And people who can't, won't.

blindauer
+2  A: 

Well, I used to ask them to sort a million integers in 2MB of memory, but then stackoverflow.com came along...

Nick Johnson
8 bit, 16 bit or (*gulp*) 32 bit initegers?
dysfunctor
32 bit integers, of course. :)
Nick Johnson
People like you are why I stopped enjoying interviews :-)
Bob Moore
A: 

What software have you shipped to customers?

I generally want to hire someone that has shipped bugs to customers*, so that they've already learned how expensive/painful it is to live with low-quality software.

*shipping software == shipping bugs

John Stauffer
+1  A: 

What aspects do you love about programming?

John Nolan
A: 

My old HR manager taught me to use the classic: "What are your three strengths, and three weaknesses?"

Surprisingly effective, if only because I'm constantly amazed at how many candidates fail to prepare for this question.

Aside from that, just sitting them down with a piece of paper and some programming exercises is very effective.

Keith Williams
The three strengths and weaknesses are Laziness, Impatience, and Hubris.
Cristian Ciupitu
I hate these kinda questions "what is your weakness"! What the hell? Then they can say "Sorry, we don't hire people who have weakness X that you said you have". It sounds like a way to find a reason not to hire you.
hasen j
Sounds like a question an HR manager would love. I was asked this on the first interview at IBM research labs; I stayed until the end of the interview out of politeness, and canceled the second interview. If this is the best question you can come up with - I don't want to work with/for you.
David Lehavi
So what are you looking for in the answer? What does this tell you about a person's programming ability?
David Wolever
Three strenghts/weaknesses seem like a lot to come up with on the spot.
Matt Grande
I've never found answers to this type of question helpful in determining if we should hire a particular candidate.
Sam
+1  A: 

Ask about previous projects that they have worked on, then get them to draw out the architect/UI screens etc based on that project. It will show if they really understood what they were doing.

Nicks
+2  A: 

What kind of developer you are interested to sort from the chaff?

If you want someone for a "quick, we need someone who can code in xyz for our project" maybe you can focus on strictly technical and/or domain related questions.

If you are want to find some long term addition to your team, some more "all rounded" tests can be made (IMHO). So, don't look to much at correct syntax or such things.

BTW, you must obviously check at TheDailyWTF series on interviews to get a list of what NOT to do! :)

Myrrdyn
+1  A: 

Which do you consider the best product/project you have ever worked with? and WHY?

Prakash
+1  A: 

The single most effective interview question I had was to write a small program in a langage of my choice ( Python, at the time ) in one hour.

And there was a full review after it, abour code quality, compliance to goals formatting, error handling and all. I remembre doing OK at the time.

Johan Buret
+5  A: 

Find a decent software problem worth solving, without any tricks and get them to talk out their solution and then do the psuedo code on it. if that is good enough then get them to write it in a programming language of their choice, syntax is not critical but the basic idea.

Could be fizzbuzz could be something else...

Some people cannot remember exact syntax, or are not great writing on the board/paper but through these 3 methods you will figure out if they have a clue.

You are trying to help them show their worth, not to trick them or to make them look bad.

Brian G
+4  A: 

I like to set a problem 24hrs or so before the interview. Some thing that requires the use of a fundamental algorythm is good, perhaps entailing a quick sort or the use of linked lists etc. The code should be written as they would any production code and the language should preferably be the one the post will entail but could be in any language of their choosing.

They then email me their answer, I get the rest of the team to review the code and mark it out of 100 based on a standard scoring sheet.

I use the returned code to help short list the candidates.

The code is then used as the basis of a set of interview questions along the lines of 'explain why you've used algorythm X'.

It's not so much what they write but HOW they write the code. Does the code contain error handling, use good structure, etc. They should be able to justify why they used algorithm X to algorithm Y. The code could be cut and paste from the internet but what I'm looking for is an understanding of fundamentals and the ability to decide between 2 or more methodologies and know and to be able to justify why they've made the descision.

DaveF
Yay, it's university all over again.
TraumaPony
+10  A: 

My single most effective interview question is:

"Imagine you're at home, relaxing, and you decide that you want to check the news. You sit down at your computer, fire up your web browser, and enter cnn.com into the address bar. What happens?"

I've received answers ranging from "The page comes up" to a 30 minute disseration detailing canonicalization, DNS, the transport and application protocols, and more. The beauty of this question is that there isn't really a right or wrong answer; It more speaks volumes to the breadth and depth of their domain knowledge.

Fhoxh
This is a great one. We used to ask the same question but based upon searching Google - we then extended it to ask about sessions, load balancing, databases, caching and so on.
Darren Greaves
Answer: "How technical of an answer are you looking for?"
Paul Nathan
This is my favorite network interview question. I phrase the question more specifically: "You type "cnn.com" -- what is the next packet that comes out of your network interface?"
Rob Adams
Nothing, you gotta hit enter first
I.devries
Well, assuming you hit enter first, the answer varies depending on your ARP cache and whether or not the name server is on your subnet.
Adam Jaskiewicz
This question is too biased. It favors guys like me having studied (and forgotten most of) communication engineering. Nothing is better than a relaxing evening with some http://en.wikipedia.org/wiki/Bit_stuffing. :-)
Thomas Jung
It reroutes to foxnews.com automatically. j/k
jasonk
+7  A: 

I like to ask which project (or projects) a candidate is most proud of. This gives them a chance to delve into the details of those projects and usually provides a good sense of the person's passion, capability, skillset, etc.

Wedge
+17  A: 

I like to ask candidates if they write code or develop applications as a hobby. If they answer yes to that, it tells me a lot about them; and in particular, how passionate they are about their chosen profession. It is all too common for developers these days to simply do it because it pays well, and not because they love writing code.

That said, there are plenty of great programmers that do not code as a hobby - but they probably used to.

Dane
+1 I like this question, though I think your second thought is probably pretty common. Most developers I've worked with don't want to spend more time in front of their computers when they get home...something I simply can't fathom ;-)
bedwyr
Wait... it pays well?
SnOrfus
It does for programmers that work for me. YMMV :)
Dane
A: 

What is your favorite part of software development and why?

Darron
+4  A: 

"What is the difference between a class and an object". If someone can't get that right (and explain it succinctly" I don't want to waste the next 45 minutes to an hour to tech screen them.

fuzzbone
+4  A: 

Semi-simple algorithms on a whiteboard are good because:

  • The point is not to be clever or have heard of it before. It is to get a good guess about how the candidate will operate on a day-to-day basis on day-to-day problems.
  • If there are many solutions, you can see how the candidate approaches many aspects including speed of coding, speed of algorithm, and design quality.
  • By asking them to write in syntactically correct code (in their favorite language, assuming you know it a little bit), you get a good sense for how experienced and comfortable they are as a coder. If they mess up easy syntax, it's a big red flag. If they have poor design or out-of-date / questionable patterns, it's a warning.
Tyler
+1  A: 

For java, a good and simple "weed-out" question is "give me a general overview of java collections".

Moving things around in maps, lists, etc. etc. is such a basic part of most java code that you can't really accomplish much if you don't have a clear understanding of this. After that I'd move on to more specific technical bits.

Steve B.
Yup, we used to ask them to explain the key properties of a List, a Set and a Map - amazing how many didn't know.
Darren Greaves
+10  A: 

I usually start with something along the lines of:

"Tell me about the tools you currently use to do your job."

I'm constantly surprised by the answers I receive to this one. The point isn't to look for a particular tool or technology, (no VI vs Emacs. vs VS.NET arguments) but rather to quickly assess how much experience and passion they might have for this job.

If a candidate stumbles over themselves trying to tell me that they use Visual Studio... we probably don't need to talk much more. (And this happens way more often than I ever would have thought.)

Conversely, if they start talking about NUnit, or Clover, or Nant, or JIRA, or FogBugz, or CC.NET, or whatever, you all of a sudden have a lot of useful stuff to direct the rest of the interview.

Kyle Chafin
I'd keep in mind with this question that not every developer you're going to interview has had a chance to use some of the more cutting edge commercial tools. Developers in many companies don't get to dictate which tools they use.
Mike Daniels
+3  A: 

Say you have a text file with one string per line. How do you find the top ten most frequently occurring strings?

I always start with a question where the answer boils down to "use a map" or "use a set" and I let the candidate answer using any programming language or pseudo-code. This particular question leads to lots of great follow-ups about running time and boundary conditions.

I think it's draconian to have one question where if the candidate answers it wrong, you say don't hire no matter what. That said, it's too easy to get it wrong and still get hired :)

Craig P. Motlin
My first instinct to solving this problem was to sort the strings and then iterate over them keeping track of the one that occurred most which only uses a few temporary variables. If the candidate chose a language like C, they would have to implement their own map/set libraries ;)
Charles Ma
"sort < infile | uniq -c | sort -nr | head". How is this a programming problem?
Rob Adams
Sorting is a fine answer that many candidates give. Of course, I follow up by asking "What if the text file is 100 million lines long?"Since our technology department uses C++ and Java almost exclusively, it's rare that we interview a candidate who only knows C.
Craig P. Motlin
+4  A: 

By 'removing the wheat from the chaff' I'm assuming you're referring purely to technical competency.

I find what gets 85% of them is to solve a question using recursion.

It could be as simple as writing a function that calculates factorial or traverses a tree.

The question that gets the next 5% would be to ask them to write code that they would most often intuitively write in a loop, e.g. write a function that reverses each word in a sentence. Then ask them to change it from a function that loops to one that recurs.

Having to abstract it one level gets a lot of them.

Then I'll ask them if they are familiar with tail recursion (if not I'll explain, no penalty) and ask them to rework the solution to be tail recursive. This gets another 5% of them.

For good measure, I also ask them to flesh out most of the utility methods they use like string.Split.

On an aside, these are the conditions I always test in:

  1. The candidate can use their preferred language (we're testing abstract thinking, not language competency).
  2. I always let them have excess to a computer for language reference.
  3. There is never a time limit.

I find this simple process gives me the remaining 5% that I want to hire.

fung
+2  A: 

Why do you program?

ironfroggy
A: 

Start from a basic Library application. Users should be able to search and checkout a book from a list of books. Design both database and the classes. Add more complexity depending upon the design.

Nikhil Kashyap
A: 

Get them to solve a few questions from Project Euler.

TraumaPony
A: 

I wonder how many of these answers are based on the long term success at hiring productive developers, and how many are merely based on what types of questions make for an interesting/enjoyable interview, from the interviewer's perspective?

It seems to me most companies can't even identify the strengths and weaknesses of their current employees that have been their for months or years... Until they can do that, judging prospective employees in a short interview isn't likely to happen.

Disclaimer: I left a job 6 months ago that had a team of 50 working on a big project for 5 years, that's already 2 years late. They aren't done, and from talking to my old coworkers, there's no end in sight. Or actually the end is still 6 months away, just like it has been for the last 2 years. My frequent disagreements with the way the project was run don't necessarily mean I was right, but if I did agree with them all along I certainly would have been wrong. :D

KeyserSoze
A: 

You have a bowl with 200 fish in it. Of these fish 99% are not guppies. How many fish should you remove so that 2% of what remains are guppies. Show your work.

dacracot
It is amazing how many people get it wrong... answer is 100.
dacracot
I find "clever" questions like this one very annoying. And I'm not the only one. This is sixth grade math.
Cristian Ciupitu
A: 

My ten-second interview:

How many seconds are in a day?

If someone can't answer that off the top of their head (without having to calculate it), odds are they haven't read enough code to be a good developer.

toohool
What kind of code would that be? One from TheDailyWTF?
Cristian Ciupitu
Google Code Search for "86400" => 202,000 results. Including 160 instances in Mozilla, and 59 in the Linux kernel.
toohool
This question doesn't make much sense to me, either. I'm sure I've never hard-coded 84600 into anything I've written.
Mark Bessey
Mark Bessey, I sure hope you've never hard-coded 84600 into anything you've written. Especially when the comment just before yours gives an answer that's usually accurate for 363 or 364 days out of each year.
Windows programmer
Years of development experience, and I didn't know that off the top of my head. If the answer can be found in 6 seconds in google, then what good does it do them to know it off the top of their head?
Noah
+2  A: 

I find "tell me about examples of bad programming practice" very effective. You would be supprised at the amount of times I need to give them assistance "OK well maybe if you can tell me about some examples of bad programming practice"

A: 

In a past interview I was asked to solve a problem not related to programming at all. It was a question about how best to package and ship ribbons (it wasn't a ribbon company).

The interviewer later told me he always throws one off the wall question in the interview to see if you can give a quality answer for a subject you know absolutely nothing about.

I did well, I guess, but I declined the job offer for a better one. That was a good interview.

Dr. Bob
+17  A: 

My favorite programming question was this:

Find the bug in this program:

int main() {
    char *p = malloc(strlen("Hello"));
    strcpy(p, "Hello");
    printf("%s world\n"), p);
}

This worked pretty good for a few years. Some folks recognized the buffer overflow, some didn't. Then one candidate said, with no discernible pause, "Which bug? I see five."

Then I changed the question to "Find as many bugs as you can in this program."

P.s. The five bugs he saw were:

  1. no "#include"s to declare the functions.
  2. wrong signature for main()
  3. didn't check return value from malloc
  4. "strlen()" should be "strlen() + 1"
  5. no "return" statement.
Rob Adams
6. Extra right-paren in printf() call. But I'm sure you put that in just to see if we were paying attention. :-) Great question!
Adam Liss
I believe that "int main()" is considered legal. I know it's not proof, but my copy of the C99 Draft standard uses that in several of its examples. If I find something more concrete, I'll follow up.
Evan Teran
Yes this signature for main() is perfectly valid. To make up for it, the assignment from malloc() gets a compile time error in C++ (but it's valid C).
Windows programmer
well if you are gonna bark up the c++ tree, then the "no return" isn't a bug either. Since c++ explicitly allows main to not have a return statement (it's equivalent to "return EXIT_SUCCESS;".
Evan Teran
IMO, bugs are things the compiler cannot check for you. Bugs make valid programs incorrect. Hence only 3 and 4 are bugs.
trinithis
Uh, isn't the BIG bug in this code the fact that the memory is allocated but never freed?
Andrei Krotkov
+1  A: 

Depends on the position, but I tend to pick something they claim to know well, ask a simple question about it, and then follow their answer with increasingly complex/difficult/esoteric questions to learn:

  • How well they really know the subject, which gives a sense of their interest and ability to remember details.
  • How well they can organize and articulate their thoughts.
  • What sort of thought process they have: logical/haphazard, transparent/opaque.
  • Whether they'll ask for clarification if they don't understand an intentionally vague question.
  • Whether they are honest when they finally don't know the answer, or if they'll try to fake it.
  • How they react to potentially stressful situations.

For example, I'll ask a C programmer for the output of the two fragments:

for (i=0; i<10; i++) { printf("%d\n", i); }

and

for (i=0; i<10; ++i) { printf("%d\n", i); }

Then I'll ask for the reasoning behind the answers, and if necessary, ask the candidate to rewrite each for() loop as a while() loop. I'm far more interested in the thought process than the original answer.

Adam Liss
Ok, now I'm intrigued. The output should be the same. Why ask them the samequestion twice?
Mark Bessey
Yes, it should -- you get the job, for tact, curiosity, and assertiveness as well as expertise. :-) You'd be surprised how many folks think the second fragment will print 1 through 10 because of the pre-increment.
Adam Liss
A: 

My most effective question is one I almost missed, out of nervousness about the guy I was interviewing with (I had heard stories...): show me how you would lazy-load a member variable that you know will be shared among multiple threads.

[He had to remind me by saying, "is that your final answer". I then saw I hadn't used "check twice, load once"]

John Saunders
A: 

I use to ask about the last technical book the interviewed read (and when he/she read it), as well as about the reasons of choosing that book and what he/she learned from there.

I consider that if he/she has passion, ambition, he/she will keep reading.

Cătălin Pitiș
A: 

"Why is the manhole cover round" of course, what else?

Evgeny
A: 

My favorite question is: if the system goes down, what might be wrong? and how do you find out the causes? and what to do next?

This series of questions can test if the interviewee is a problem solver and his/her experiences. For the question of possible causes, a good candidate can list a bunch of them, from the system itself to its running environment, for example: disk full, too many open files, OutOfMemoryException, network connection interruption, etc. For the question of how to hunt down the problems, a good candidate may also come up a bunch of methods, like application log, OS log, telnet, dig, jvm profiling, etc. For the question of finding out a solution, this question might be the easiest part. But you can also ask if there are alternative solutions? If so, how to choose one of them? This might be tricky. A good candidate might do a cost-benefit analysis to decide.

yanky
A: 

This is my favorite:

How would you make a social networking site? Whats your approach?

Ravi
A: 

What did you dislike most about your last boss/job/work environment? followed up with

How would you describe your perfect work environment?

The goal being to figure out if they will fit in the team. You can teach them skills, but if they don't fit it's going to be an up hill battle. If everything they hate is what they are going to get, skip them earlier. It's also a way to gauge character/attitude. If they are extremely negative/critical with no diplomacy you've got a red flag for the future.

jasonk