Friday, February 23, 2007

In Defense of Logic Questions

Microsoft has a history of asking logic questions in its interviews.  Because of this, there are many web sites talking about the questions and given answers to them.  There is even an entire book dedicated to the subject called How Would You Move Mount Fuji?  There are those who believe strongly in their usefulness.  There are others who think they have no value.  I fall into the first camp, but only up to a point.  There are two sorts of logic questions.  One is very useful, the other not.  There are logic questions I will call complete.  These are the questions where everything needed to solve them is presented in the problem description.  There are also those I will call incomplete which require knowledge beyond the scope of the problem to solve.

Logic questions are useful when hiring for computer-related jobs because they represent the same sort of thought process required to program or test software.  Computers are pure logic.  They will do exactly what they are told to do and nothing more.  They are unforgiving.  They do not draw inferences.  Close enough doesn't count.  To make them do what you want, you have to be explicit.  To understand why they break, you must comprehend where the logic broke down.  Logic questions tend to exercise the same pathways in the mind.  Being able to figure them out is a good indicator that someone can figure out software.

Logic questions get their poor reputation from the use of incomplete questions.  These questions require you to "think outside the box."  That may be good, but they don't really allow the interviewee to be creative.  Instead, they look for one particular piece of information outside the box.  Solving them is more about getting lucky than it is about applying logic.

Here is a good example of a bad logic question:  Assume there is a room with three light bulbs in it.  Outside the room is a light switch with 3 switches on it labeled A, B, and C.  Once you enter the room, you will no longer be able to access the switches.  How can you, upon entering the room, tell me which of the three switches controls each of the light bulbs?

Think about this question for a moment.  Do you have the answer?  With merely the given information, it is not possible to formulate the answer.  Instead, one must start thinking about characteristics of the light bulb and switches.  Can I take apart the switch?  Can I somehow see into the room before opening the door?  Is there something about the bulbs themselves that I can use to my advantage?

The answer is the following:  Turn on switch A for 5 minutes or so.  Now turn it off and turn on switch B.  Enter the room.  Upon entering, the lit bulb is clearly connected to B.  Feel the other two bulbs.  The one which is warm is attached to A.  By process of elimination, the cool one is connected to C. 

Is it really fair to fail someone in an interview for not thinking about the properties of light bulbs?  Other questions require understanding of math, physics, geometry, etc. that, while the person may once have taken, probably aren't fresh in their mind.  Assume that a candidate gets these questions wrong.  What do you know?  You know that they either are not a logical person or that they don't have a complete understanding of light bulbs.  Unless the knowledge of light bulbs is critical to the job at hand, avoid the question.  It doesn't provide useful information.

There is a better sort of logic question to use.  These I call complete questions.  They contain within them all the information one needs to divine the answer.  The candidate needs only apply the rules of logic to the problem statement and they will succeed.

Here is an example of a simple, yet complete question:  There is a river.  You start on one side with a wolf, a pig, and a carrot.  There is a raft which you can use to cross the river.  Unfortunately, the raft is too small to hold more than 2 things (you being one of them) at a time.  You need to get yourself and all three of the others to the opposite side to continue your journey.  Unfortunately, without you present, the pig will eat the carrot and the wolf will eat the pig.  How do you get all 3 to the other side?

If you are reading this, hopefully the right solution comes to mind fairly quickly.  This question is a bit more simple than I would normally ask but it does demonstrate the point.  The candidate merely needs to find the right combination of things and trips across the river to succeed.  He doesn't need to understand the nature of pigs beyond the fact that they eat carrots.  He doesn't need to recall vector math to calculate the path across the flowing river.

The answer is as follows:  Take the pig across the river and live it there.  Now come back and get the wolf.  Take him across.  On the return trip, bring the pig back to the original side of the river.  This time across take the carrot over and leave it safely with the wolf.  Finally, go back for the pig and bring it across.  All three are now on the other side of the river.  Journey on.

Hopefully you can see and understand the distinction between the light bulb question and the pig question.  Failing to answer the first is ambiguous why the failure happened.  Failure to answer the second can only be a failure to apply the rules of logic correctly.

One point that should be made is that you should never judge someone on the failure to answer a single logic question.  Each question requires particular train of thought and just because someone doesn't reach it doesn't mean that they are illogical.  Sometimes their mind is so busy going down other paths that it never reaches the right one to solve the problem.  In short, it is easy to get hung up on one approach to a problem.  Whenever you ask a question such as those I advocate here, you should always have a second question handy.  Only if someone fails both questions should you pass judgement.  Missing one solution is understandable.  Missing two is a sign that the individual in question may not be able to handle this sort of problem solving.

Much of the recent anti-logic-question backlash has, IMHO, been caused by failing to make the distinctions I make in this post.  Logic question, if used correctly, are an invaluable arrow in the quiver of an interviewer.  Especially when interviewing someone for a non-coding position, the question can provide valuable information that is very difficult to glean otherwise.


  1. I'm going to be doing a series not on testing but on the people that carry it out. This will be a post

  2. Early example of the incomplete question:

  3. And what happens if on and off on the switch doesn't relate to on and off for the lightblub. ;-)