I understand that the question is not entirely about this, but I insist: there is no such reason (except, of course, some kind of force majeure with loved ones, with health, but then the person will not have time for the exam, I suppose), which will be adequate to sit up late before the morning exam.
In the overwhelming majority of cases, students ask themselves why? Because they sit and teach all night. Of course, you may have a baby or a pipe burst in your house, but 99% is exactly the night (often convulsive, trying to catch up) cramming. So - this is NOT NECESSARY. It is better to go to bed early, sleep and wake up early to review / teach before the exam. But this night cramming violates absolutely all the laws of preparation: firstly, students most often sit down and sit all night - such an amount of continuous study blurs the brain and after a few hours significantly reduces the effectiveness of study; secondly, after a while, the lack of sleep also begins to press, and this also reduces the effectiveness of the study (moreover, the further, the faster the decrease); thirdly, and this is probably the most important thing - by the time a student goes to the exam after a sleepless night, all his cognitive skills drop sharply, concentration and speed of thinking drop dramatically, and his memory starts to fail.
Even if a student poured coffee and feels relatively nothing (relatively - because he cannot feel good after a sleepless night of cramming), all the same, the parameters of his brain are reduced, and noticeably (this has been scientifically proven many times and it has been proven in various experiments, for example, with cosmonauts, and somnologists do such experiments; therefore, by the way, getting behind the wheel very sleepy is not much better than drunk).
Thus, even if he managed to memorize something during the night (and it is really possible to learn well from scratch not so much in a few hours), then there is a high probability that he cannot remember it, so also, from carelessness and a decline in concentration, he can easily make mistakes even where they should not be.
The fact that many people pass and teach this way does not mean that this is correct. And it says that if they taught correctly, they would pass easier / better. I'm not even talking about the harm of such constant deadlines to health, brain and central nervous system.
In general, ideally, you need to finish the study-repetition of all topics the day before the exam, and devote this day to rest - get a good sleep, exercise (light) physical activity, take a walk in the fresh air, get away from thoughts of surrender and generally try not to think about tomorrow. Before going to bed, briefly (!) Repeat the tickets / topics, go to bed early, sleep well, wake up early and before the exam once again consolidate all the material without haste.
Better sleep for 1-2 hours! For a while, this will symbolically deceive the body. If you don't sleep at all, you will feel like a vegetable. In the morning - a jug of coffee or strong tea (IF NO PROBLEMS WITH PRESSURE AND HEART). Pulling up on the crossbar, or pushing up the physically possible number of times will not hurt. And - forward. Fatigue will come quickly, but after the exam.
If there is no chance of getting a good night's sleep, then in my opinion there is no particular point in going to bed for a couple of hours. Personally, it only made me worse. But what I would advise is to sleep, but no more than 20-25 minutes. Be sure to use an alarm clock. It is important not to plunge into a deep phase of sleep, otherwise you will not be able to wake up with any feeling of cheerfulness.
If you do not sleep all night before the exam, your head will be heavy and it will be difficult to think. Once I did not sleep for more than a day, it was not very good. At eight o'clock in the morning of the next day, I wanted to sleep, drowsiness still came after 20 minutes (although I tried to drown it with drinks). The best thing before the exam is a good sleep.