Once you have dealt with the emotional aspect of failure you will be ready to proceed with improving the quality of your work for the next assignment.
Before all else be sure to figure out what your task is expecting of you. Click here to obtain valuable information on task understanding.
You will then want to be sure to break your task into smaller, more manageable chunks. This way you can set yourself small goals that you will be able to meet within 2 hours. Click here to learn more about goal setting.
Be sure to evaluate your past successes and failures. By being mindful of your strategies you are using for studying, note taking, etc. (Tips on how to become a better learner can be found here).