4. If $a$ and $b$ are both prime numbers, and $a^{4}+13b=107$, then the last digit of $a^{2011}+b^{2012}$ is ( ).
(A) 9 or 3
(B) 8 or 3
(C) 9 or 7
(D) 1 or 3
4. A.

From the condition, we know that $a^{4}$ and $13 b$ must be one odd and one even.
If $a^{4}$ is even, then $a=2, b=7$. At this time,
$$
\begin{array}{l}
a^{2011}+b^{2012}=2^{2011}+7^{2012} \\
=\left(2^{4}\right)^{502} \times 2^{3}+\left(7^{4}\right)^{503} .
\end{array}
$$

From $\left(2^{4}\right)^{502}$ having the last digit as 6, and $\left(7^{4}\right)^{503}$ having the last digit as 1, we know that the last digit of $2^{2011}+7^{2012}$ is 9.
If $13 b$ is even, then $b=2, a=3$. At this time,
$$
\begin{array}{l}
a^{2011}+b^{2012}=3^{2011}+2^{2012} \\
=\left(3^{4}\right)^{502} \times 3^{3}+\left(2^{4}\right)^{503} .
\end{array}
$$

From $\left(3^{4}\right)^{502}$ having the last digit as 1, and $\left(2^{4}\right)^{503}$ having the last digit as 6, we know that the last digit of $3^{2011}+2^{2012}$ is 3. Therefore, the last digit of $a^{2011}+b^{2012}$ is 9 or 3.