Another word for exam is test. We see the word "test" in "testily". Testily means easily annoyed. Testily was cleverly used to express the feelings Tom had about his exam.
I flunked my exam , said Tom , testily .