I've seen several versions of this paradox--in some, it's an execution rather than an examination (the parallel suggests a rather grim view of the life of an academic), but it's essentially the same. I think it comes from Willard van Orman Quine, a philosopher and logician. Anyway, here's the way it works:

At the beginning of some period (let's say the semester), the professor of some class makes the following guarantee, "At some point during this class, there will be a surprise quiz. You will not know when the quiz is to be administered until I give it." One particularly bright student comes to the conclusion that, in fact, this statement is false, and so there will be no such quiz. She reasons thusly:

If it came to be the last day of the term, and we had not yet had the quiz, we would know that it had to come on that day, and so, since we are guaranteed that it will be a surprise, it cannot. Therefore, the quiz can't occur on the last day. But wait! If it comes to be the second-to-last day, and we haven't yet had the quiz, then we will know it has to come on that day (since we've already determined that it can't come on the last day, and it hasn't come yet). Therefore, when it comes, it will not be a surprise, so it can't happen on the second-to-last day, either. In fact, this same reasoning can be used back to the very first day! So, by simple deduction, it is certain that the professor cannot have spoken truly, and so there will be no quiz.

What makes this a paradox is that it seems as though it guarantees that there simply isn't a way to truly announce a surprise quiz. However, though the flaw in the reasoning may be difficult to see, it seems as though it must be wrong, because the conclusion seems absurd!

An interesting coda has been suggested by Selmer Bringsjord. In it, the student remains relaxed throughout the semester, knowing that the quiz can never come. However, precisely because she has figured this out, when the quiz comes on the last day, it is a surprise to her. :-)

In reply to Gritchka's well-developed writeup, there seems to be a problem. You've concluded, seemingly correctly (though there are questionable steps, they seem largely unnecessary, such that the conclusion seems still to be well-supported), that, "If it were true what the judge/teacher said that it would be unexpected whenever it was, then you could conclude U(4) to U(1) and derive a contradiction. But phrasing it as the row from Alfie to Eric clearly shows that it is not true. And that's fine: that's our common sense understanding." Essentially, the initial statement by the teacher was false.

Here's the further problem, then--logic seems to suggest that one could not honestly include a surprise examination in a syllabus, yet this seems to occur quite frequently. There's still a paradox, only now the problem is that there is a statement which seems to be both clearly possible, and yet necessarily false.

Reply to Gritchka's reply to my reply to his writeup:

The following statements are inconsistent:
  • On December 30th, you don't know whether the fire drill will be a surprise.
  • You believe the claims of the administration that there will be a surprise fire drill.
If you really don't know whether to believe the administration, then since there is no external guarantee that they'll keep their word about having the fire drill at all (both because laws are sometimes broken and to keep faith with the original example of the surprise examination), and people often believe that the chances they will keep their word decrease as December 31 approaches, it can still be a surprise even on the last day of the year.

So my sense is that what's really going on is a very subtle disanalogy in the examples we're considering. It matters whether there is outside confirmation--the fact that there is only one source for information about both the rule and the examination's existence makes things interesting.