which of the spaces are Locally Compact
A subset of $\mathbf R^2$ is compact iff it is closed and bounded (by Heine-Borel theorem), so a subspace of $\mathbf R^2$ is locally compact iff a small enough closed ball around any given point is still closed as a subset of $\mathbf R^2$ (because compactness is absolute, and of course it is bounded). This should be enough to solve the problem by yourself.
As for the answers, 1 is locally compact as martini said, 2 is indeed not locally compact (but it does not follow from the fact $\mathbf Q$ is not locally compact), 3 is locally compact, and 4. is locally compact.
As an additional hint for 4.: notice that it is an open subset of $\mathbf R^2$.
For 4):
All open or closed subsets of a locally compact Hausdorff space are locally compact in the subspace topology. $R^2$ is locally compact and Hausdorff and $D = p^{-1}((5, \infty))$ is the inverse image of an open set under a continuous function $p(x,y) = x^2+103xy+7y^2$.
I believe 4 is locally compact when you consider $\Bbb{R}^2$ with the Euclidean topology. If you plot the region $D$ in wolframalpha, you should see why.
By the way the fact that 2) is not locally compact does not follow from $\Bbb{Q}$ being not locally compact, although the proof is similar.