2. If the difference between the roots of the equation $x^{2}+p x+1=0(p>0)$ is 1, then $p$ equals ( ).
(A) 2
(B) 4
(C) $\sqrt{3}$
(D) $\sqrt{5}$
2. (D).

From $\Delta=p^{2}-4>0$, we get $p>2$. Let $x_{1}, x_{2}$ be the two roots of the quadratic equation, then $x_{1}+x_{2}=-\frac{1}{2}, x_{1} x_{2}=1$. This leads to $\left(x_{1}-x_{2}\right)^{2}-$ $\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}$, so $1^{2}=(-p)^{2}-4$. Therefore, $p^{2}=$ $5, p=\sqrt{5}(p>2)$. Hence, the answer is (D).