Does there exists an abelian or nonabelian group G where $|Z(G)|=p^2$ for p a prime? I have known cases of abelian and nonabelian groups that have a center of order p but never a power of p. Is there at least a known case where $|Z(G)|=p^2$?
 A: In what follows, we construct a $p$-group with centre of order $p^n$ for arbitrary $n\geq 1$ (in fact, we constructs groups with arbitrary centre, but the construction gives a $p$-group if the centre has order $p^n$). It is (essentially) Exercise 5.2.2. from Robinson's book "A Course in the Theory of Groups" (p138 in my version).
For your example, you want to take $A=C_{p^2}$ or $A=C_p\times C_p$. These two choices of $A$ will give two non-isomorphic non-abelian $p$-groups with centre of order $p^2$.

Let $A$ be a non-trivial abelian group and set $D=A\times A$. Define $\delta\in\operatorname{Aut}(D)$ as $(a_1, a_2)^{\delta}=(a_1, a_1a_2)$. Let $G$ be the semidirect product $\langle \delta\rangle\ltimes D$.
Then one can prove that this group is finite if $A$ is finite, and moreover (part $(a)$ of the exercises) that $Z(G)=G^{\,\prime}\cong A$.

Parts $(b)$ and $(c)$ of the question are,
$(b)$ Prove that $G$ is a torsion group if and only if $A$ has finite exponent (note that finite exponent is stronger than just torsion),
$(c)$ Deduce that even if the centre of a nilpotent group is a torsion group, the group may contain elements of infinite order,
which are entirely irrelevant to the question at hand, but interesting nonetheless.
A: $\mathbb{Z} / p^2 \mathbb{Z}$, the cyclic group of order $p^2$, is an abelian group of order $p^2$. Hence $|Z(G)| = p^2$. 
A: Certainly any abelian group of order $p^2$ does. The two such abelian groups are (up to isomorphism) $\mathbb Z_{p^2}$ and $\mathbb Z_p\times \mathbb Z_p$.
A: Take any simple group $\,G\,$ and direct-multiply it with an abelian group of order $\,p^2\,$ , say $\,H:=G\times C_{p^2}\,$ , and here you have a non-abelian example.
Of course, instead of simple above you can take any centerless groups, say $\,S_n\,\,,\,\,n\geq 3\,$ . This is what Mark commented before.
