Answer: A
Only W is precipitated by calcium, which is the behaviour of a carboxylate soap. X, a sulphonate that keeps foaming in hard water, is an anionic detergent. Y has a positive quaternary ammonium head, so it is cationic. Z carries no charge, so it is non-ionic.