You'd think being in a good mood would help you perform better on tests, etc., but it isn't that cut and dry.
Contrary to popular belief, being in a pleasant mood doesn't necessarily mean you're going to perform well when taking an exam. For example, your test performance depends on some level on your mental abilities.
Mood does matter when it comes to performing cognitive tasks. However, not only is this a relatively new idea, the kind of mood that's beneficial or detrimental to one's performance all depends on the kind of mental tasks one is being asked to perform. Cognitive neuroscientists at Washington University in St. Louis have investigated the relationship between mood and cognitive performance by showing subjects ten-minute clips from both classic horror films and prime-time television comedies.
They found that the prefrontal cortex, a particular region of the brain, is activated by a combination of mood, state, and cognitive tasks, but not by either one alone. Additionally, while happy moods seemed beneficial to certain cognitive tasks, they were detrimental to other tasks. Similarly, anxiety produced by the horror film clips was detrimental to some cognitive tasks, while beneficial to others. These findings suggest that the prefrontal cortex mediates the interaction between mood and cognition in order to regulate the person's performance on whatever cognitive task is at hand.