Explanation:
in short : the mass goes linearly with the density.
the mass of the bottle filled with that acid is
the mass of the bottle itself (23g) plus the acid filling, which 1.25 times more dense than the water filling.
the water filing itself had a mass of 39 - 23 = 16g
the acid filing has therefore a mass of 16×1.25 = 20g
so, in total, the bottle filled with the acid has a mass of
23 + 20 = 43g