2. Let $A=[-2,4), B=\left\{x \mid x^{2}-a x-4 \leqslant 0\right\}$, if $B \subseteq A$, then the range of real number $a$ is
A. $[-1,2)$
B. $[-1,2]$
C. $[0,3]$
D. $[0,3)$
Let $f(x)=x^{2}-a x-4$, according to the problem, the two roots of $f(x)=0$ are $x_{1}, x_{2} \in[-2,4)$. Since $\Delta=a^{2}+16>0$, we have $\left\{\begin{array}{l}f(-2)=2 a \geqslant 0, \\ f(4)=12-4 a>0, \\ \frac{a}{2} \in[-2,4)\end{array} \Rightarrow a \in[0,3)\right.$. Therefore, the answer is $D$.