You are standing before two closed doors. One of the doors leads to heaven and the other one leads to hell.
Two watchmen are standing, one in front of each door. You know one of them always tells the truth and the other always lies, but you don’t know which watchman tells the truth and who is the liar.
You can ask only one question to one of them, in order to find the way to heaven. What will you ask?
You should go to any one of the watchman and ask him:
“If I ask the other watchman about which side leads to heaven, what would he answer?”
If we ask a direct question, “Which door leads to heaven”? then the honest one will tell the truth and lier-watchman will point toward the door that leads to hell.
But here we are not asking the direct question, we are asking one watchman about how the other will answer.
If you ask the honest watchman how the other (lier) will answer, he knows that the lier will point toward hell, so he will tell you that the answer will be the hell’s door.
If we ask the lier watchman how the other (honest) will answer, he knows that the honest one will tell point toward heaven door, but since he is a lier himself he will tell you the other door (which is the door of hell).
Hence, in both the cases, irrespective of whether the watchman is honest or lier, he is pointing to the Hell’s door. So you can chose the other path to continue your journey to heaven.
This type of questions are generally not asked in companies like Microsoft, Adobe, Amazon, Google, etc. where focus is more on logical puzzles that can be converted into computer programs. This is more of a brain-teaser question asked mostly in companies like Infosys, Wipro etc.