You wrote the same sentence twice, so I'm not sure if there are more than two options. Nevertheless, the sentence which contains a verbal phrase acting as a modifier is the second one - Giving a presentation in front of my class, I suddenly developed severe stage fright.
Here, the verbal phrase giving a presentation in front of my class is used as a modifier, an adverbial modifier stating the reason why this person developed stage fright. On the other hand, in the first sentence, passing my driving test on the first attempt is not used as a modifier, but rather as the subject of this sentence.