2. Which of the following calculations is correct? ( ).
(A) $\left(a b^{4}\right)^{4}=a b^{8}$
(B) $(-3 p q)^{2}=-6 p^{2} q^{2}$
(C) $x^{2}-\frac{1}{2} x+\frac{1}{4}=\left(x-\frac{1}{2}\right)^{2}$
(D) $3\left(a^{2}\right)^{3}-6 a^{6}=-3 a^{6}$
2.D.
$$
\begin{array}{l}
\left(a b^{4}\right)^{4}=a^{4} b^{16},(-3 p q)^{2}=9 p^{2} q^{2}, \\
\left(x-\frac{1}{2}\right)^{2}=x^{2}-x+\frac{1}{4} .
\end{array}
$$