Why are dreams about failing exams so common?
Yes this kind of dreams are commonly called nightmares. The reason we experience nightmares is to prepare us for threats in the real life.

"A dream-production mechanism that tends to select threatening waking events and simulate them over and over again in various combinations would have been valuable
for the development and maintenance of threat-avoidance skills."

http://www.unil.ch/files/live//sites/ln/files/shared/Revonsuo_1.pdf