Part (a)
The potential energy of the block due to its height can be given as,
The potential energy due to presence of spring can be expressed as,
Equating both the values,
Substitute the known values,
Thus, the maximum compression of the spring is 0.253 m.
Part (b)
Since the slide is frictionless, therefore no energy loss happened during the sliding of block. Therefore, the block will rise up to the same initial height which is 0.500 m.