Distinguish between formaldehyde and acetaldehyde

Formaldehyde (HCHO) and acetaldehyde (CH3COOH) may be distinguished by performing the iodoform test with NaOI(I2/NaOH). Acetaldehyde gives a yellow precipitate while formaldehyde does not.

CH3COOH + 3NaOI → CH3COONa + CHI3 (yellow ppt) + 2NaOH

or

CH3COOH + 3I2 + 4NaOH → CH3COONa + CHI3 (yellow ppt) + 3NaI + 3H2O