Iodoform test is given by those compounds which has COCH3 group and also those alcohols which produces the CH3CO group on oxidation so here in this case acetone has COCH3 group and ethanol on oxidation produces CH3CHO so it also has CH3CO group but in diethyl ketone we have CH3CH2COCH2CH3 means we have ethyl group so that is why it cannot gives iodoform test.