Correct: The boy who passed the exam was very happy.
Incorrect: The boy passing the exam was very happy.
Really interesting. So, the -ing structure here is short for "who was -ing". But "the boy who was passing the exam" sounds odd, I think, because while you can be driving a car you can't normally be passing an exam. You can take an exam, and be happy while taking an exam, but to pass (or fail) an exam is not a continuous action that allows for the progressive tense. It is an instantaneous event, a yes/no condition, and not something where you can report on progress.
Alternately you can say someone is "doing well" on an exam, "The boy doing well on the exam was happy." While this sounds a little strained, it's not as bad as "passing".
Note that with other definitions of "pass" this structure is fine:
The car passing to my right is going much too fast
The man passing a kidney stone is in great pain
The quarterback passing the football scored a touchdown
The criminal passing bad checks was caught red-handed
The agent passing as a border guard managed to get useful information.
And so on. Note these might not be the best way to express each thought, but they are grammatically acceptable.