(a)
\[
\begin{aligned}
& \log _5 x=2 \\
& \therefore x=5^2 \\
& \therefore x=25
\end{aligned}
\]
(b)
\[
\begin{aligned}
& \log _x 4=2 \\
& \therefore 4=x^2 \\
& \therefore x=\pm 2 \\
& \therefore x=2 \text { (since } x \neq-2 \text { ) }
\end{aligned}
\]