To test for an aldehyde or ketone, the compound is reacted with 2,4-dinitrophenylhydrazine (2,4-DNPH).
Compounds containing a carbonyl group will under go a condensation reaction, forming a deep orange precipitate.
Aldehydes and ketones can be differentiated by purifying the precipitate and measuring the melting point and comparing to literature values.
Only aldehydes and ketones will give a positive result, carboxylic acids and esters will not.