Cloudmere, Inc. Interview Question
Software Engineer / Developersask: "which exit lead to heaven the other will tell me?" Answer from either A or B will lead to hell.
Ask A pointing to a path "where it leads to heaven?" He may say yes or no. Now go to B and ask about the same path "this path dont lead to heaven. say yes or no?" He may say yes or no. Now if both says yes that means it a path to heaven. If both says no it means it is not. If answer is mix of yes and no then:
Ask A, did he die? if he says NO, hes the one who always lies. Ask B, which is the door to heaven and take that door.
If A says Yes, take the other door that B did NOT say went to heaven
ask 1 person whether u died in a car accident ?
case 1: (asking a TT) he will say yes..
so ask the other one whether he is standing at heaven or hell
whatever he 'll say we will negate that..
case 2: (asking a lier)::
as he is lier and he died in car accident so he will say no
means u will come to know that u were talking to a lier now u know that the other 1 is Truth teller so ask him whether he z standing at heaven if yes then go to this door otherwise to other 1.
Question to A: What will B say where the heaven entrance is;
Question to B:Ask for heaven entrance;
If the two friends points to the same entrance it is the hell entrance;(A is true and B is false)
If the two friends points different entrances ;entrance shown by second friend is the way to heaven.(A is false and B is true.)
C will Ask the person in front of the gate to tell the other guys response
- Prasanna February 02, 2012"What will be the guy in the next door's response, if i ask him that i will reach heaven by going through this gate"
Scenario - 1:
Say C asks this question to A and assume he always speaks lie and he stands in front of heaven
Since A speaks Lie and B truth so B would obviously say Yes so A's response will be NO.
Scenario - 2
Say C asks this question to A and assume he always speaks Truth and he stands in front of heaven
Since B would have told No and he blindly will reply back B's response since he says truth he would say again NO.
Scenario - 3
A standing in front of Hell and he always speaks lie
B would have responded No because he always says truth and A would say YES.
Scenario - 4
A standing in front of Hell and he always speaks Truth
B on the opposite gate would have responded saying Yes and A would promptly respond back with the same answer Yes.
The probability can be used for Person B scenario but the responses and situations are alike.
So if C gets a reply NO -- Enter to heaven (Same Gate)
IF C gets a reply YES -- Go to the opposite or the other gate.