I have that exact dream frequently, and it's usually a situation where I won't graduate if I don't pass the course. I think it's a very common dream. Sometimes there will be variations, such as I'm in a play, in full costume, about to go on stage and realize I have NO idea what any of my lines are or even what the play is about!
Haven't had them lately, but my dream is very similar, only it's not an exam but an unfinished dissertation. In other words, I've finished all the PhD classwork, and still have an outstanding dissertation to complete. Usually, it's been a few years since the classwork was fully completed in the dream, and I've got to start and finish the dissertation by this year, etc. Very disturbing; it seems so realistic.