The opportunity cost of having a study time for a test is less sleep. However if you have a test and you can't make up for it, the opportunity cost would be the lost chance of keeping up with good grades if you are maintaining a high score. On the other hand, the opportunity cost of having more sleep is less study time.