This question already has an answer here:
The following puzzle being very much recreational for me, I couldn't resist myself from sharing it with my fellow MSE user friends. Let's have a look at it.
You are the most eligible bachelorette in the kingdom, and as such the King has invited you to his castle so that you may choose one of his three sons to marry. The eldest prince is honest and always tells the truth. The youngest prince is dishonest and always lies. The middle prince is mischievous and tells the truth sometimes and lies the rest of the time.
As you will be forever married to one of the princes, you want to marry the eldest (truth-teller) or the youngest (liar) because at least you know where you stand with them.
The problem is that you cannot tell which brother is which just by their appearance, and the King will only grant you ONE yes or no question which you may only address to ONE of the brothers. What yes or no question can you ask which will ensure you do not marry the middle brother?
Though it wasn't given in the original problem let's impose the condition that "No answer" isn't a possible answer.
Note: this problem is also called the Bachelor Problem, with genders reversed (explicitly mentioned so that (SE) searches on either name will succeed).