Answer:
I believe the defense mechanism Robert is using is rationalization.
Step-by-step explanation:
Rationalization is the defense mechanism that leads us to make up excuses for something. By finding an explanation for what happened - even if not a true one -, we feel less anxious, as if there was nothing we could do about it, since it was not our fault. That is what Robert is doing. Instead of accepting that he failed his test for whatever reason truly led him to fail, such as procrastinating his studies, he chose to make excuses and blame elements outside of himself. He is rationalizing in order to feel less upset and concerned as a result of his own mistakes by believing it was someone else's fault.