2. The range of the function $f(x)=\sqrt{x-3}+\sqrt{12-3 x}$ is ( .
(A) $[1, \sqrt{2}]$
(B) $\left[1, \frac{3}{2}\right]$
(C) $[1, \sqrt{3}]$
(D) $[1,2]$
2. D.

Since $3 \leqslant x \leqslant 4$, we have $0 \leqslant x-3 \leqslant 1$.
Let $x-3=\sin ^{2} \theta\left(0 \leqslant \theta \leqslant \frac{\pi}{2}\right)$.
Then $f(x)=\sqrt{x-3}+\sqrt{3(4-x)}$
$=\sin \theta+\sqrt{3\left(1-\sin ^{2} \theta\right)}$
$=\sin \theta+\sqrt{3} \cos \theta=2 \sin \left(\theta+\frac{\pi}{3}\right)$.
Thus, $1=2 \sin \left(\frac{\pi}{2}+\frac{\pi}{3}\right)$
$\leqslant f(x) \leqslant 2 \sin \left(\frac{\pi}{6}+\frac{\pi}{3}\right)=2$.
Therefore, the range of $f(x)$ is $[1,2]$.