Answer: D. solids and liquids only
Explanation:
Solids have definite volume because they have almost no inter-molecular space between its molecule, they are closely packed and rigid in their structure and hence they also have a definite shape.
In case of liquids we have a little inter-molecular space which makes the liquid-bulk flexible enough to attain any shape but this inter molecular space is not sufficient enough to make them compressible making them negligibly compressible. Therefore liquids are also considered to have a difinite volume.
But in the case of gases there is very large inter molecular space and the molecules make a random motion due to very weak force of attraction between them and the space between the molecules is compressible on the application of force. So, they don't have a definite shape and definite volume.