Which occupies more space: 5 g of solid gold or 5 g of liquid gold?
It depends really.
Space is a question of volume, which depends on a lot of things.
For example, is the solid gold in powder form? Is it smelted into a lingot (remember that five grams are twenty-five carats)? Is it smelted into a hollow shape?
In what container is the liquid gold in?
What temperature are we considering the solid gold and the liquid gold? Gold is solid at any temperature below 1064 ºC and liquid at any temperature above that and below 2856 ºC, while density - the property that links mass and volume changes with temperature.
All of these are factors that will influence the answer.