Solution:
Concept: A is joined to the negative terminal, so it is the cathode (the carbon lining of the tank); B is joined to the positive terminal, so it is the anode (graphite). C is the molten electrolyte.
Step 1 — (i) Substance of electrodes A and B.
Both are made of carbon (graphite): A is the gas-carbon lining of the tank, B is a thick graphite block.

Step 2 — (ii) Electrode where aluminium is formed.
Aluminium is formed at A, the cathode, where aluminium ions gain electrons:
Al3++3e−→Al
The molten aluminium collects at the bottom of the tank.
Step 3 — (iii) Two aluminium compounds in the electrolyte C.
Alumina (Al2O3) and cryolite (Na3AlF6). (Fluorspar, CaF2, is also present but contains no aluminium.)
Step 4 — (iv) Why electrode B must be replaced.
The oxygen set free at the anode B reacts with the hot graphite and burns it away as carbon dioxide:
C+O2→CO2↑
So B is gradually consumed and must be replaced.
Watch out: Fluorspar is in the electrolyte, but it is not an aluminium compound; the two asked for are alumina and cryolite.
Therefore, (i) both are carbon (graphite); (ii) at A, the cathode; (iii) alumina and cryolite; (iv) B is burnt away by the oxygen set free at it.