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 - correct capitalisation, punctuation and spacing make posts much easier to read.
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.