There are two possible choices for the adjacency matrix for the given undirected graph $G$ and hence two possible answers.
Your first choice could be:
$A(G) = \begin{pmatrix}
0 & 1 & 0 & 0 & 0\\
1 & 0 & 1 & 1 & 0 \\
0 & 1 & 1 & 0 & 1 \\
0 & 1 & 0 & 1 & 1 \\
0 & 0 & 1 & 1 & 0 \\
\end{pmatrix}$
The problem with this matrix is that Handshaking lemma is not satisfied here because sum of each row gives the total degree of each vertex and so here total degree = $12$ and total edges in the graph is $7$.
The reason is, this matrix is made on the assumption that self-loop has degree $1$ and that's why $\textbf{Handshaking Lemma}$ will be failed here because the reason we take the degree of the self-loop as $2$ to make Handshaking Lemma satisfied.
Hence, if we make the assumption that self-loop has degree $1$ then the answer will be $2$ because of self-loops, each with degree $1.$
Now, your second choice could be:
$A(G) = \begin{pmatrix}
0 & 1 & 0 & 0 & 0\\
1 & 0 & 1 & 1 & 0 \\
0 & 1 & 2 & 0 & 1 \\
0 & 1 & 0 & 2 & 1 \\
0 & 0 & 1 & 1 & 0 \\
\end{pmatrix}$
Here, Handshaking lemma is satisfied because total degree=$14$ because sum of all the rows is $14.$ and Hence, total number of edges is $7.$
Again the reason is, this matrix is made on the assumption that self-loop has degree $2$ and that's why $\textbf{Handshaking Lemma}$ will be satisfied here because the reason we take the degree of the self-loop as $2$ to make Handshaking Lemma satisfied.
Hence, if we make the assumption that self-loop has degree $2$ then the answer will be $4$ because of self-loops, each with degree $2.$
Most probably, GATE Authority will give answer as $2$ because the convention follows in most of the books whether it is Diestel, Bondy & Murthy, Douglas B. West, Narsingh Deo or Harary, All follows first convention but I have given the true picture so that all of you know about the issue with this question.
Edit: After challenge, answer has been changed from 2 to 2 or 4.