Let $f : \mathbb{R}^2 \to \mathbb{R}$ be a continuous map such that $f(x) = 0$ for only finitely many values of $x$. Is it necessary that either $f(x) \leq 0$ for all $x$, or, $f(x) \geq 0$ for all $x$
I don't think its necessary because if $f(x,y)=x$ then $f$ is continous and it takes both positive and negative values.
Yes, this statement is true. And one idea could be to prove it by contradiction.
So, assume that $f(\mathbf{x})=0$ only for finitely many $\mathbf{x}\in\mathbb{R}^2$, and yet it's not true that either $f(\mathbf{x})\le0$ for all $\mathbf{x}\in\mathbb{R}^2$ or $f(\mathbf{x})\ge0$ for all $\mathbf{x}\in\mathbb{R}^2$. The last part means that there exist at least one $\mathbf{x}_1\in\mathbb{R}^2$ such that $f(\mathbf{x}_1)<0$ and at least one $\mathbf{x}_2\in\mathbb{R}^2$ such that $f(\mathbf{x}_2)>0$. Now the key idea is that there are infinitely many paths connecting the points $\mathbf{x}_1$ and $\mathbf{x}_2$ in the plane, and since $f$ is continuous, there exist points at which $f$ is zero on each such path.
For example, let's say $f(-1,0)<0$ and $f(1,0)>0$. Consider $f$ restricted to the arcs of parabolas $y=a(x^2-1)$, $-1\le x\le1$, for all $a>0$. All these arcs connects these two points, and at the same time they don't have any common points other than the endpoints. Since $f$ is continuous along each arc and goes from being negative to being positive, $f$ is equal to zero at least once on each of them.