Here \(n = 40\) and the sample mean is
\begin{equation*} \bar{x} = \frac{3\times 0 + 7\times 1 + 12\times 2 + 11\times 3 + 3\times 4 + 2\times 5 + 2\times 6} {40} \\ = 2.45. \end{equation*}
The sample variance is
\begin{equation*} \frac{3\left( 0 - 2.45 \right) ^{2} + 7\left( 1 - 2.45 \right) ^{2} + 12\left( 2 - 2.45 \right) ^{2} + 11\left( 3 - 2.45 \right) ^{2} + 3\left( 4 - 2.45 \right) ^{2} + 2\left( 5 - 2.45 \right) ^{2} + 2\left( 6 - 2.45 \right) ^{2}} {39} \end{equation*}
which is 2.151.