As we know, by universal coefficient theorem, $H^{1}(X,\mathbb{Z})$ is torsion-free. My question is: 
for cup product $H^{1}(X,\mathbb{Z})\otimes H^{1}(X,\mathbb{Z})\rightarrow H^{2}(X,\mathbb{Z})$
could $a\cup b$ be a torsion element in $H^{2}(X,\mathbb{Z})$.



One question on cup product and torsion elements
An example is given by a 3-manifold. Specifically, for any $n$ other than $0$ or $\pm 1$ we can take the real Heisenberg group $G$ of $3 \times 3$ real matrices of the form
$$
\begin{bmatrix}
1 & a & b \\\\
0 & 1 & c \\\\
0 & 0 & 1
\end{bmatrix}
$$
where $a,b,c \in \mathbb{R}$. We then take the quotient $G/H$ by the subgroup $H$ of elements where $a,b,(nc) \in \mathbb{Z}$. These manifolds are $K(H,1)$ manifolds and the group $H$ is a nilpotent group with cohomology
$$
\mathbb{Z}, \mathbb{Z}^2, \mathbb{Z}/n \times \mathbb{Z}^2, \mathbb{Z}.
$$
The cup product of the two generators in degree one is the generator of the $\mathbb{Z}/n$ in degree two. This can be checked by using the Lyndon-Hochschild-Serre spectral sequence associated to the central extension $1 \to \mathbb{Z} \to H \to \mathbb{Z}^2 \to 1$, with a useful intermediate step being the determination of the abelianization of $H$.


In some sense, these examples are universal, which can be seen using a little bit of homotopy theory. If you have two cohomology classes whose cup product is $n$-torsion, then (by the correspondence between cohomology classes and maps to Eilenberg-Mac Lane spaces) we have two cohomology classes $X \to K(\mathbb{Z},1)$ such that the composite
$$
X \to K(\mathbb{Z},1) \times K(\mathbb{Z},1) \stackrel{cup}{\longrightarrow}
K(\mathbb{Z},2) \stackrel{n}{\longrightarrow} K(\mathbb{Z},2)
$$
is nullhomotopic. This means that it lifts to the homotopy fiber
$$
F \to K(\mathbb{Z},1) \times K(\mathbb{Z},1) \stackrel{n \cdot cup}{\longrightarrow} K(\mathbb{Z},2).$$
This homotopy fiber $F$, in fact, is precisely the classifying space of the group $H$ (which is at least plausible from the long exact sequence of homotopy groups).


