Let $Q$ be a linear functional on $\mathcal C^{\infty}(\mathbb R^n, \mathbb R)$ such that if $f(0)=0$ and $f(x)\geq 0$ in some neighborhood of $0$ then $Q(f)\geq 0$.
Prove that: $$Q(f) = \sum_{i,j} a_{ij}\frac{\partial^2 f}{\partial x_i \partial x_j}(0) + \sum_i b_i \frac{\partial f}{\partial x_i }(0) + cf(0) $$
Intuitively, it is true that $Q$ must not depend of $f(k\neq 0)$ and so, of any differentiable operators in $k\neq 0$.
Also $Q$ must not depend of derivatives more-two order.
And I think some $a_{ij}$ can be zero (the criterion of Sylvester).
But why in the this formula for $Q(f)$ is no anything else?
First, notice that if $f|_U =0$ for some neighborhood $U$ of $0$, then $f \ge 0$ on $U$, and $f\le 0$ on $U$. Therefore $Q(f)\ge 0$ and $Q(f)\le 0$. Hence $Q(f)=0$.
Thus $Q$ induces a functional on the ring of germs at $0$.
Edit: I misread the original question, missing that we are assuming that $f=0$.
The original argument can be salvaged however.
Suppose $f(0)=0$, and all first and second derivatives of $f$ at the origin are $0$. Then consider the function $g_c(x)= c\sum_i x_i^2$. If $c>0$, then $g_c$ is greater than or equal to $f$ on some neighborhood of $0$. Similarly, if $c<0$, then $g_c\le f$ on some neighborhood of the origin. Then if $c > 0$, $Q(f) \le Q(g_c) = cQ(g_1)$ for all $c$, and if $c<0$, $Q(f) \ge Q(g_c) = cQ(g_1)$. Taking $c\to 0$ from above and below, we get $0\le Q(f) \le 0$. Hence $Q(f)=0$ if $f$ and all of its first and second derivatives at the origin are $0$.
Now for any smooth function $f$, let $T_2f$ be the second Taylor polynomial of $f$ at $0$, $T_2f(x) = \sum_{i,j} f_{ij}(0)x_ix_j + \sum_i f_i(0)x_i + f(0)$. $$Q(f) = Q(f-T_2f + T_2f) = Q(f-T_2f) + Q(T_2f) = 0 + Q(T_2f)=Q(T_2f).$$
Hence $Q$ only depends on the values of $f$ and its first two partial derivatives at $0$.
Original argument:
Generalizing this, if for all $\epsilon$, $f$ has a neighborhood $U$ of $0$ on which $|f|\le \epsilon$, then $Q(f)=0$.
To see this, observe $f \le \epsilon$ on $U$, so $f-\epsilon \le 0$ on $U$. Thus $Q(f-\epsilon) \le 0$, so $Q(f)\le Q(\epsilon)=\epsilon Q(1)$. Similarly, $f\ge -\epsilon$ on $U$, so $f+\epsilon \ge 0$. Therefore $Q(f+\epsilon) \ge 0$, or $Q(f)\ge -Q(\epsilon) = -\epsilon Q(1)$. Hence $|Q(f)|\le \epsilon Q(1)$. ($Q(1)\ge 0$, since $1\ge 0$). Since this is true for all $\epsilon$, $|Q(f)|=0$, so $Q(f)=0$.
However $f$ is continuous, so if $f(0)=0$, then by continuity, there is such a neighborhood for every $\epsilon$. Thus this seems to say that if $f(0)=0$, $Q(f)=0$.
Thus we seem to have $$Q(f)=Q(f-f(0)+f(0))=Q(f-f(0))+f(0)Q(1) = 0 + f(0)Q(1)=Q(1)f(0)$$ for all $f$. However, perhaps I've made a mistake somewhere, since you seem to suggest that $Q$ could depend on the first or second derivatives of $f$.