The most accurate response that applies to the formation of all fossil fuels is:
Heat and pressure build up on top of decaying matter.
While other options mention specific environments (like swamps or oceans), the buildup of heat and pressure is a fundamental process that characterizes the formation of fossil fuels, including coal, oil, and natural gas.