Correct Answer is: (b) Q2/4C
As the capacitors are identical, they will finally have charge Q/2 each.
Initial energy of the system = Ei = Q2/2C.
Final energy of the system = Ef = 2 [Q/2)2 / 2C] = [Q2/4C].
Heat produced = loss in energy = Ei = Ef = Q2/4C.