Answer: A
P is 4-hydroxy-4-methylpentan-2-one (diacetone alcohol) and Q is (CHX3)X2C=CHCOCHX3, 4-methylpent-3-en-2-one. The haloform reaction converts the methyl ketone COCHX3 into COOX− and gives CHClX3. Acidification gives (CHX3)X2C=CHCOOH, 3-methylbut-2-enoic acid.