show that if $K$ is a field then $K[x]$ is principal [duplicate]

Hint: Let $0 \neq I \subsetneq K[x]$ be an ideal. Let $0\neq f\in I$ such that

$$ deg(f)= \min\{ deg(g) \ : \ g\in I \}.$$

Use your argument above to show $I=(f)$.

For your second question I'd suggest that you show that the ideal $(2, x)\subseteq \mathbb{Z}[x]$ is not principal.