Solution (source code)

= Solution
{c}

Since $X^2=X(X-1)+X$, the second <moment> is $\mathbb E[X^2]=G''(1)+G'(1)$. Subtracting the squared <mean> gives
$$
\boxed{\operatorname{var}(X)=G''(1)+G'(1)-\bigl(G'(1)\bigr)^2.}
$$