A sound coming from my iPhone when it was turned off?

I was sat in a exam and during the last 5 mins a noise was made surrounding me, at first I thought it was someone else making it with the metal in the tables/chairs but then people nearby started to look at me, so it must of been. After the exam they asked me what was it, fortunately I wasn't disqualified. Any answers relevant to this would be helpful, thank you.

Probably it wasn't turned off and it was vibrating on metal