Sometimes its just lack of preparation. Sometimes its being unlucky. Unlucky in a sense na on the day of the exam, you just feel that you are not in your peak performance (giduka, galain ang tyan, migraine, etc.).
Bottom line here is not about the failure, its about how you deal with that failure and how it makes you a better person.