I find that studying right before sleeping is very helpful in remembering things for a test. I remember I had crammed all my studying right before going to sleep and it turned out that it was advantageous for me because I remembered everything. Sleeping right after studying, helped my brain make connections, which helped me remember things during a test. I find that this only works for multiple choice test. When the tests, are short answer or essay based, studying right before sleeping is not as helpful.