P(passing) = 1 - ( P(guessing 0 correct) + P(guessing 1 correct) +...+ P(guessing 15 correct) )
I would use the second equation to solve the problem because there are fewer terms to have to deal with. (16 terms vs 25 terms)
P(guessing a single question correctly) = 1/5
P(guessing a single question incorrectly) = 4/5
P(guessing 0 correct) = (4/5)^40
P(guessing 1 correct) = 40 (1/5)(4/5)^39
P(guessing 2 correct) = (40(39) / 2) (1/5)^2 (4/5)^ 38
You have to generate all 16 terms with the last one being
P(guessing 15 correct) = (40! / (15! 25!)) ((1/5)^15 (4/5)^25
Sum the 16 terms and subtract them from 1