Given a group $Q$ and an abelian group $C$, I want to determine the number $I(Q,C)$ of isomorphism classes of all groups $G$ having a central subgroup $C'$ isomorphic to $C$ such that the quotient $G/C'$ is isomorhic to $Q$. Thus $I(Q,C)$ equals the number of groups (up to isomorphism), that fit into a central extension $$ 1 \to C \to G \to Q \to 1$$ The number of such extensions (up to equivalence) is given by $|H^2(Q,C)|$ (trivial coefficients). This gives an upper bound. But often it is much larger than $I(Q,C)$ (cf. the example below).
Question: Is it possible to obtain the correct value for $I(Q,C)$ out of $H^2(Q,C)$, or at least an improved upper bound ?
Example: Let $C_n$ denote the cyclic group of order $n$. Each $p$-group $G$ of order $n$ has a central subgroup $C_p$. Hence $I(G/C_p,C_p)$ is the number of isomorphism classes of $p$-groups of order $n$.
Take $n=2$. Then there are exactly two groups of order $p^2$, i.e $I(C_p,C_p) =2$, while $|H^2(C_p,C_p)| = |\mathbb{Z}/p\mathbb{Z}| = p$. From these $p$ extensions, $p-1$ belong to the isomorphism class of $C_{p^2}$.