2. If the remainders when $n^{2}+4$ and $7 n-2$ are divided by 3 are the same for two unequal positive integers $n$ not exceeding 100, then the number of such integers $n$ is ( ).
(A) 4
(B) 5
(C) 6
(D) 7
2. A.

From $\left\{\begin{array}{l}1 \leqslant n^{2}+4 \leqslant 100, \\ 1 \leqslant 7 n-2 \leqslant 100,\end{array}\right.$ we get $\frac{3}{7} \leqslant n \leqslant \sqrt{96}$.
Since $n$ is an integer, the possible values of $n$ are
$1,2,3,4,5,6,7,8,9$.
Because $\left(n^{2}+4\right)-(7 n-2)=(n-1)(n-6)$ is a multiple of 3. Then $n-1$ or $n-6$ is a multiple of 3, so $n$ can only be $1,3,4,6,7,9$.
Also, $n^{2}+4 \neq 7 n-2$, so $n \neq 1$ and $n \neq 6$.
Therefore, $n$ can only be $3,4,7,9$.