Technical Interview

Home
Added Recently
Data Structures
Puzzles
Google & Microsoft
C/C++ Questions
Java Interview Questions
Quantitative Problems
Algorithms
Featured Articles
Amazon Interview Question
Compaq Interview Question
Technical Interview
Interview Process
Introduction Questions
Object Oriented
Google Pages
Fundamental Questions
Resume Tips
Links
Contact Us
Submit Question/Answer
 THREE SPIES:

Three spies, suspected as double agents, speak as follows when questioned:

Albert: "Bertie is a mole."
Bertie: "Cedric is a mole."
Cedric: "Bertie is lying."


Assume that moles lie, other agents tell the truth, and there is just one mole among the three; determine:

1.) Who is the mole?
2.) If, on the other hand, there are two moles present, who are they?


Solution:

Bertie is the mole. Both Albert and Cedric are telling the truth. Hence, when Albert said, "Bertie is a mole," he was telling the truth, and giving you the correct answer. When Bertie said, "Cedric is a mole," he was lying, as he himself is a lying mole. When Cedric responded, "Bertie is lying," he was telling the truth, and also affirming that Bertie was lying.

In the second case, if there were 2 moles, the identifications would be a direct inverse. Both Albert and Cedric would be moles, and Bertie would be telling the truth.