Method for every cell: left electrode = anode (oxidation), right electrode = cathode (reduction). Write the overall reaction, find n, then use the Nernst equation at 298 K:
Ecell=Ecell∘−n0.059logQ
where Q has products over reactants; pure solids and liquids are taken as 1 and a gas at 1 bar also contributes 1.
(i) Mg | Cu cell
Reaction: Mg(s)+Cu2+(aq)→Mg2+(aq)+Cu(s), n=2
Ecell∘=0.34−(−2.36)=2.70 V
Ecell=2.70−20.059log[Cu2+][Mg2+]=2.70−0.0295log0.00010.001
Ecell=2.70−0.0295×1=2.67 V
(ii) Fe | H2 cell
Reaction: Fe(s)+2H+(aq)→Fe2+(aq)+H2(g), n=2
Ecell∘=0.00−(−0.44)=0.44 V
Ecell=0.44−20.059log[H+]2[Fe2+]pH2=0.44−0.0295log(1)20.001×1
Ecell=0.44−0.0295×(−3)=0.44+0.0885=0.53 V
(iii) Sn | H2 cell
Reaction: Sn(s)+2H+(aq)→Sn2+(aq)+H2(g), n=2
Ecell∘=0.00−(−0.14)=0.14 V
Ecell=0.14−20.059log[H+]2[Sn2+]pH2=0.14−0.0295log(0.020)20.050
Ecell=0.14−0.0295log125=0.14−0.0295×2.097=0.14−0.062=0.078 V≈0.08 V
(iv) Br− | Br2 ‖ H+ | H2 cell
Anode (left, oxidation): 2Br−(aq)→Br2(l)+2e−
Cathode (right, reduction): 2H+(aq)+2e−→H2(g)
Reaction: 2Br−(aq)+2H+(aq)→Br2(l)+H2(g), n=2
Ecell∘=EH+/H2∘−EBr2/Br−∘=0.00−1.09=−1.09 V
Ecell=−1.09−20.059log[Br−]2[H+]21=−1.09−0.0295log(0.010)2(0.030)21
(0.010)2(0.030)21=(1.0×10−4)(9.0×10−4)1=1.11×107,log(1.11×107)=7.046
Ecell=−1.09−0.0295×7.046=−1.09−0.208=−1.30 V
The negative emf means the cell as written is not spontaneous. The spontaneous reaction is the reverse, Br2+H2→2Br−+2H+: in a real cell the bromine electrode would be the cathode (+) and the hydrogen electrode the anode (−).

Answers: (i) 2.67 V; (ii) 0.53 V; (iii) 0.08 V; (iv) −1.30 V.