Answer
The same gun will shoot the rubber ball up to a height of $4h$
Work Step by Step
When the spring is compressed a distance $x$, we can find an expression for the height $h$. By conservation of energy, the gravitational potential energy at maximum height will be equal to the elastic potential energy stored in the spring:
$mgh = \frac{1}{2}kx^2$
$h = \frac{kx^2}{2mg}$
We can find an expression for the maximum height $h_2$ when the spring is compressed a distance of $2x$:
$mgh_2 = \frac{1}{2}k(2x)^2$
$h_2 = \frac{k(2x)^2}{2mg}$
$h_2 = 4\times \frac{kx^2}{2mg}$
$h_2 = 4h$
The same gun will shoot the rubber ball up to a height of $4h$.