What is formed at the anode and cathode when the following solutions are electrolysed?

sodium iodide
copper II chloride
sodium sulphate
NaOH
HCl
magnesium nitrate

also is this true: if the metal in the compound is higher in the reactivity series than hydrogen then hydrogen is produced instead of the metal at the positive electrode.

To determine the products formed at the anode (positive electrode) and cathode (negative electrode) during electrolysis, you need to consider the reactivity of the elements involved and the composition of the electrolyte solution. Here are the products formed when the following solutions are electrolyzed:

1. Sodium Iodide (NaI):
At the anode: Iodine (I2) is formed.
At the cathode: Sodium (Na) is formed.

2. Copper II Chloride (CuCl2):
At the anode: Chlorine gas (Cl2) is formed.
At the cathode: Copper (Cu) is formed.

3. Sodium Sulphate (Na2SO4):
At the anode: Oxygen gas (O2) is formed.
At the cathode: Hydrogen gas (H2) is formed.

4. Sodium Hydroxide (NaOH):
At the anode: Oxygen gas (O2) is formed.
At the cathode: Hydrogen gas (H2) is formed.

5. Hydrochloric Acid (HCl):
At the anode: Chlorine gas (Cl2) is formed.
At the cathode: Hydrogen gas (H2) is formed.

6. Magnesium Nitrate (Mg(NO3)2):
At the anode: Oxygen gas (O2) is formed.
At the cathode: Magnesium (Mg) is formed.

Regarding your question about the reactivity series, it is generally true that if the metal in the compound is higher in the reactivity series than hydrogen, then hydrogen gas is produced instead of the metal at the positive electrode (anode). This is because metals that are higher in the reactivity series have a stronger tendency to lose electrons, leading to their oxidation and the formation of hydrogen gas. However, there may be exceptions depending on the specific conditions and other factors present during the electrolysis process.