Cathode: If the metal ion is above hydrogen then hydrogen will be produced instead. This is because Hydrogen is LESS reactive.
Anode: If a concentrated Hallide (e.g. Chlorine, Bromine or Iodine) ion is present than the halogen is produced. If not then OXYGEN is produced
When to use it: If the metal is ABOVE carbon in the reactivity series!