Jagger is correct--there was a fundamentally identical riddle in the movie Labyrinth, which involved, rather than two questions and altered behavior from the ogre, two doors, each guarded by an animate doorknocker in the shape of a head. Jennifer Connelly, as the young lady in the movie, knows that one of them always tells the truth, while one of them always lies. However, she can ask only one question, making it somewhat harder. She solves the puzzle, seemingly correctly, by asking one of the heads what the other head would say if she asked it what way she should go.

If she asked the liar, then the other head is the truth-teller, so it would have told her correctly, but the head she asked would lie about this, and so would tell her to go the wrong way. On the other hand, if she asks the truth-teller, then it will truthfully report the treacherous advice that the other head, being a liar, would have given. Either way, she ought to go in the direction opposite the direction she is told.

This is one of a large class of problems known as Knights/Knaves problems. Many of them can be found in the puzzle books of Raymond Smullyan, a mathematician, magician, and (almost) Taoist sage at Indiana University, particularly The Lady or the Tiger? and The Riddle of Scheherazade, though they are addressed by different names in those books.

One other example of a problem of this type follows:

There are two sorts of people: knights, who always tell the truth, and knaves, who always lie. There are three people, A, B, and C.

A says: B is a knave!
B says: A and C are of the same type.

Of what type is C?

I first saw this problem on a test given as a part of an experiment by Selmer Bringsjord, in which I assisted. The solution follows:

SOLUTION: C is a knave. For imagine that A is a knight--in that case, what A said was true, therefore B is a knave. If B is a knave, then what B said is FALSE--since B claimed that A and C were of the same type, C must be of a different type than A. Since A is a knight, this would make C a knave. But now imagine that A is a knave. In that case, A's claim that B is a knave must be false, so B is a knight, and speaks truly. Since B truly claimed that A and C were of the same type, and A is a knave, C must be a knave. Therefore, no matter what type A is, C must be a knave.