4. Let the maximum value of the function $f(x)=\sqrt{2-x}+\sqrt{3 x+12}$ be $M$, and the minimum value be $m$. Then the value of $\frac{M}{m}$ is ( ).
(A) $\frac{\sqrt{6}}{2}$
(B) $\sqrt{2}$
(C) $\sqrt{3}$
(D) 2
4. D.

From the conditions, the domain of the function $f(x)$ is $[-4,2]$. When $x \in(-4,2)$,
$$
\begin{array}{l}
f^{\prime}(x)=\frac{-1}{2 \sqrt{2-x}}+\frac{3}{2 \sqrt{3 x+12}} . \\
\text { By } f^{\prime}(x)=0 \Rightarrow x=\frac{1}{2} . \\
\text { Also, } f(-4)=\sqrt{6}, f(2)=3 \sqrt{2}, f\left(\frac{1}{2}\right)=2 \sqrt{6},
\end{array}
$$

Thus, $M=2 \sqrt{6}, m=\sqrt{6} \Rightarrow \frac{M}{m}=2$.