Correct Answer - C
The initial extension spring is `x_(0)=(mg)/k`. Just after collision of `B` with `A` the speed of combined mass is `v//2`. For the spring to just attain natural length the combined mass must rise up by `x_(0)=(mg)/k`(see figure) and comes to rest.
Applying conservation of energy between initial and find state:
`1/22m(v/2)^(2)+1/2k((mg)/k)^(2)=2mg((mg)/k)`
Solving we get `v=sqrt((6mg^(2))/k)`