I'm reading a book about homological algebra. There is one exercise with whom I have a problem.
Show that for any $\mathbb{Z}$-module $M$ and any $q\in \mathbb{Z}$ we have
I) $ \ \ M\otimes_{\mathbb{Z}}\left(\mathbb{Z}/{q\mathbb{Z}}\right)\cong M/qM$
II) $\ \ \mathrm{Hom}_{\mathbb{Z}}\left(\mathbb{Z}/q\mathbb{Z},M\right)\cong\left\{ m\in M : \ qm=0\right\}$
I done first part but I don't know how to prove the second part.
I) More generally, consider a short exact sequence $0\longrightarrow I\xrightarrow{\ \ \iota\ \ }R\xrightarrow{\ \ \pi\ \ }R/I\longrightarrow 0$. Tensoring with $M$ gives a right exact sequence $$I\otimes M\xrightarrow{\iota\otimes\operatorname{id}}R\otimes M\xrightarrow{\pi\otimes\operatorname{id}} (R/I)\otimes M\longrightarrow 0\,.$$ Now there is an isomorphism $R\otimes M\xrightarrow{r\otimes m\ \longmapsto\ r\cdot m}M$ with inverse $m\longmapsto 1\otimes m$, hence yielding a right exact sequence $$I\otimes M\xrightarrow{i\otimes m\ \longmapsto\ i\cdot m}M\xrightarrow{m\ \longmapsto\ \pi(1)\otimes m}(R/I)\otimes M\longrightarrow 0\,.$$ The image of the first arrow is equal to $I\cdot M$, whence $(R/I)\otimes M\cong M/IM$.
II) Again, consider a short exact sequence $0\longrightarrow I\xrightarrow{\ \ \iota\ \ }R\xrightarrow{\ \ \pi\ \ }R/I\longrightarrow 0$. The universal property of the quotient gives an isomorphism $$\hom(R/I,M)\xrightarrow{\varphi\ \longmapsto\ \varphi\pi}\left\{f\in\hom(R,M)\mid f\iota=0\right\}\,.$$ Now there is an isomorphism $$\hom(R,M)\xrightarrow{f\ \longmapsto\ f(1)}M\,.$$ We have $$\begin{align*}f\iota=0&\iff\forall i\in I:fi=0\iff\forall i\in I: f(i\cdot 1)=0\iff\forall i\in I: i\cdot f(1)=0\\&\iff I\cdot f(1)=0\,.\end{align*}$$
Restricting, we find an isomorphism $$\left\{f\in\hom(R,M)\mid f\iota=0\right\}\xrightarrow{f\ \longmapsto\ f(1)}\left\{m\in M\mid Im=0\right\}\,.$$ Composing, we find $\hom(R/I,M)\cong\left\{m\in M\mid Im=0\right\}$.