I have seen multiple versions of this problem, expressed in different ways. The way that I first heard it (similar to the way Kelrin expresses it), has an easy answer:

"Part of your grade is a surprise quiz, to be administered at some time during the semester. You will not know when the quiz is to be administered until I give it."

Since as soon as the statement is made, a smart student (using Kelrin's logic) could work out that the quiz cannot be given at any point in the future, the only way for the professor's statement to be true is if the quiz has already been given. If no other quizzes have been given during the semester, then the only obvious question is, "How can my seemingly paradoxical statement be true?"

The professor's announcement is, in fact, the quiz. The professor's statement is true: a quiz occurred, and no student knew when (or even if) it was going to be administered, until it actually was administered. The correct answer to the quiz is merely to deduce this fact.