A substance Z reacts with NaOH to give salt and water only. When Z is…