The less reactive element is discharged at the cathode. Hydrogen is produced unless there is a reactive metal, in which case the said metal is produced. Oxygen is produced at the anode unless the solution contains group 7 ions, called halide ions, then halogen molecules are produced.