Given: Hydrocarbon X has molecular formula C6H8 and consumes two moles of H2 on catalytic hydrogenation of one mole of X.
Find: The structure of hydrocarbon X.
Catalytic hydrogenation using 2 moles of H2 shows that X contains two double bonds.
On ozonolysis, X gives two moles of methane dicarbaldehyde. This cleavage pattern matches a six-membered ring having double bonds at the 1,4-positions, because each double bond cleavage produces aldehyde ends and the ring splits into two identical molecules of methane dicarbaldehyde.

Therefore, the hydrocarbon is cyclohexa-1,4-diene. The correct option is D.