You want to test whether the population rates of passing the exam are the same for the two groups. So your null hypothesis is $H_0: p_1=p_2$ vs $H_a: p_x < p_2.$
A test of the equality of binomial proportions is discussed in the NIST handbook and implement in Minitab statistical software (among other software programs). Minitab output is as follows:
Test and CI for Two Proportions
Sample X N Sample p
1 18 123 0.146341
2 25 119 0.210084
Difference = p (1) - p (2)
Estimate for difference: -0.0637426
95% upper bound for difference: 0.0170092
Test for difference = 0 (vs < 0):
Z = -1.30 P-Value = 0.097
This Minitab procedure also includes the P-value for the
Fisher Exact Test:
Fisher’s exact test: P-Value = 0.129
While it is true that the students who had extra training showed a somewhat higher pass rate than those who did not (21.0% vs. 14.6%), both P-values exceed 0.05, so at the 5% level of
significance that pass rate for the students with additional training did not have a higher pass rate
that is statistically significant.
Addendum: Here is the intuitive rationale for
Fisher's Exact Test.
In Group 1 and Group 2 combined, you have $123 + 119 = 242$ students. Out of the $18+25=43$ who passed the exam, only 18 are from Group 1. If
all students are equally likely to pass, what is the probability that such a small number of passes in Group 1 would occur at random.
Specifically, let $X$ be the number of Group 1 passes out of 43. The P-value of Fisher's Exact Test is $P(X \le 18).$
Symbolically, this is
$$P(X \le 18) = \sum_{i=1}^{18}
\frac{{123 \choose i}{119 \choose 43-i}}{{242 \choose 43}} \approx 0.129,$$
which agrees with Minitab's P-value for the Fisher test.
In R statistical software, this is computed as follows:
phyper(18, 123, 119, 43)
[1] 0.129473
In the plot of the relevant hypergeometric distribution below, the P-value is the sum of the heights of the bars to the left of the vertical dotted line.
