5. In $\triangle A B C$, $\angle C=90^{\circ}$, if $\sin A$ and $\sin B$ are the two roots of the quadratic equation $x^{2}+p x+q=0$, then the correct relationship among the following is ( ).
A. $p= \pm \sqrt{1+2 q}$ and $q>-\frac{1}{2}$
B. $p=\sqrt{1+2 q}$ and $q>-\frac{1}{2}$
C. $p-\sqrt{1+2 q}$ and $q>-\frac{1}{2}$
D. $p=-\sqrt{1+2 q}$ and $0<q \leqslant \frac{1}{2}$
5. D. Hint: By Vieta's formulas, we know
$$
\begin{array}{l}
\left\{\begin{array} { l } 
{ \operatorname { sin } A + \operatorname { sin } B = - p > 0 , } \\
{ \operatorname { sin } A \operatorname { sin } B = q > 0 . }
\end{array} \quad \text { i.e., } \left\{\begin{array}{l}
\sin A+\cos A=-p>0, \\
\sin A \cos A=q>0 .
\end{array}\right.\right. \\
\text { Therefore, }\left\{\begin{array}{l}
p^{2}-2 q=1, \\
p^{2}-4 q \geqslant 0, \\
p<0 .
\end{array} \text { Hence } 0<q=\sin A \cos A=\frac{1}{2} \sin 2 A \leqslant \frac{1}{2}, p=-\sqrt{1+2 q} .\right.
\end{array}
$$