If there are $n$ questions on the test, then the probability of answering exactly $k$ correctly, if answers are chosen at random, is
$$\binom{n}{k}\left(\frac{1}{3}\right)^k \left(\frac{2}{3}\right)^{n-k}.$$
And it is the Muliplication Rule. To make typing simpler, I will take $k=2$, $n=5$. Write $C$ for correct, $N$ for not correct.
By the Multiplication Rule, the probability of $CCNNN$ (first two right, next three wrong) is $(1/3)^2(2/3)^3$. But we can also get two right, three wrong in several other ways, like $CNCNN$, $CNNCN$, and so on. Each has probability $(1/3)^2(2/3)^3$.
How many such strings are there? We have to choose $2$ places from the $5$ available to put a $C$ into. There are $\binom{5}{2}$ ways to do this, giving total probability $\binom{5}{2}(1/3)^2(2/3)^3$.
The same reasoning gives the general formula quoted above.
Remark: If there are only $5$ questions on the test, and we want the probability of answering all $5$ correctly, the probability is $(1/3)^5$, which is nowhere near the number quoted.
Because the formula for the probability has only $3$'s in the denominator, any probability we compute will have to be of shape $\frac{m}{3^e}$, where $m$ and $e$ are non-negative integers. The number $\frac{45}{118}$ is not of that shape, so cannot be the answer for the problem, or for any closely related problem.