2. If the graph of the function $y=x^{2}+a x+a$ given in Figure 1 intersects the $x$-axis at only one point, then $a$ is ( ).
(A) 0
(B) 1
(C) 2
(D) 4
2. D.

From the function $y=x^{2}+a x+a$ having only one zero, we know
$$
\begin{array}{l}
\Delta=a^{2}-4 \times 1 \times a=0 \\
\Rightarrow a(a-4)=0 .
\end{array}
$$

Thus, $a=0$ or 4.
But from the axis of symmetry $-\frac{a}{2} \neq 0$, we get $a \neq 0$.
Therefore, $a=4$.