What is the difference ?
He passed exam with flying colors, which means that he studied hard
He passed exam with flying colors, meaning that he studied hard
Note that it's 'He passed the exam ...'
Or "He passed his exam(s) ..."
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.
There's a flaw with the logic. The teacher could have prepared a very easy exam, or by luck, the questions might have been on the fraction of the material he studies.
I'm not a teacher, but I write for a living. Please don't ask me about 2nd conditionals, but I'm a safe bet for what reads well in (American) English.