The correct answer is C. both moisture content and amount of compaction energy.
The maximum dry density of a soil is the highest density that the soil can be compacted to. It is affected by both the moisture content and the amount of compaction energy applied.
When the moisture content is too low, the soil particles will not be able to come into close contact with each other and the soil will not be able to be compacted to a high density. When the moisture content is too high, the soil particles will be too slippery and the soil will not be able to be compacted to a high density either.
The amount of compaction energy applied also affects the maximum dry density of the soil. The more compaction energy that is applied, the higher the maximum dry density of the soil will be.
Therefore, the maximum dry density of a soil is affected by both the moisture content and the amount of compaction energy applied.