Answer
Letter D. He slammed the door when he left the principal's office.
Step-by-step explanation:
The other options give us the general context, what happened and why Ted ended up feeling angry: he confessed something to the principal and was the only one who got in trouble.
To make us visualize the way Ted was feeling, the author uses some context clues and one of them is precisely "Ted made sure to slam the door as he left". Angry people usually slam doors. The author goes on: "He frowned as he stomped down the hallway. [...] Ted was absolutely fuming."