That works when your aim is to find out the behaviour of character of a person, which is not the aim of a technical interview question. Basically the aim of the technical question is to find out how the person thinks and how creative a solution he works out, and how his thinking process works, not to find out his behavioral characteristics.
So it doesn't depend whether if it is an actual situation the candidate has gone through or if it is a hypothetical situation. In the case of a candidate applying for a first job for instance, this is a pretty good way of questioning I think !