2. Condition A: $\sqrt{1+\sin \theta}=a$; Condition B: $\sin \frac{\theta}{2}+\cos \frac{\theta}{2}=a$. Then
A. A is a sufficient and necessary condition for B
B. A is a necessary condition for B
C. A is a sufficient condition for B
D. A is neither a necessary condition nor a sufficient condition for B
Solve:
$\sqrt{1+\sin \theta}=\left|\sin \frac{\theta}{2}+\cos \frac{\theta}{2}\right|$, so A $\nRightarrow$ B. Conversely, when $a<0$, B $\nRightarrow$ A. A is neither a necessary condition nor a sufficient condition for B, hence the answer is $D$.