Answer
The required probability is, $\frac{1}{2}$
Work Step by Step
The sample space of equally likely outcomes is $\left\{ HH,HT,TH,TT \right\}$ and $ n\left( S \right)=4$
Assume $ E $ to be the event of getting two heads; then $ E=\left\{ HH,TT \right\}$; thus, $ n\left( E \right)=2$
Hence, the probability of two heads is:
$\begin{align}
& P\left( E \right)=\frac{n\left( E \right)}{n\left( S \right)} \\
& =\frac{2}{4} \\
& =\frac{1}{2}
\end{align}$