Your body an intriguing piece of biological engineering over millions of years of evolution. It has adapted so that when you're low an energy, your body can still operate in order to have the power it needs to get the energy it needs. You can call this a low-power mode.
But during low power mode, your body makes chemical changes to reduce your energy consumption, and one of the places where it does this is in decision-making.
In an effort to give your body the energy it needs, you become more impulsive and spend less time thinking about solutions before making decisions when you're hungry. As a result, our primitive "must eat" decision makers kick in instead of our logical decision makers.
The impulsive behavior, which is a result of the hormone Ghrelin being released, can cause you to make decisions that aren't exactly in your best interest, but rather one that leads to a quicker reward rather than a larger reward. This is a survival trait of our bodies, and is a primitive one at best.
Perhaps you should fill your stomach before a big test...