Water Heaters
Water heaters are pressure vessels and combustion appliances at once, so questions split into temperature-and-pressure (T&P) protection, venting, and installation location.
Every storage water heater needs a listed T&P relief valve, with the temperature element set at or below 210 degrees F and the pressure element at or below the tank's rated working pressure, commonly 150 psi. The discharge pipe must be the full size of the valve outlet, must not be reduced or trapped, must have no valve between heater and relief valve, must run by gravity, and must terminate where discharge is visible, typically not less than 6 in and not more than 24 in above the floor or outside above grade. A capped or plugged T&P is an automatic fail.
Location rules: a pan with a drain where leakage causes damage, two straps in seismic zones (upper third and lower third), and a gas-fired heater in a garage elevated so the ignition source is 18 in above the floor. Closed systems need a thermal expansion tank. Storage above 120 degrees F needs scald protection such as a thermostatic mixing valve, and 140 degrees F storage is used to limit Legionella growth.
Worked example: how long does a 40,000 BTU/hr burner take to raise 40 gallons from 50 to 140 degrees F? Water weighs 8.33 lb/gal, so 40 gal is 333 lb; a 90 degree rise needs 333 x 90 = 30,000 BTU; at 40,000 BTU/hr that is 0.75 hr, or 45 minutes, ignoring standby loss.