Solution:
Concept: A current in a wire sets up a magnetic field round the wire (Oersted, 1820). Round a long straight wire the field lines are concentric circles in planes at right angles to the wire, centred on the wire. The field is stronger for a larger current and weaker farther from the wire, and reversing the current reverses the direction of the field. Right-hand thumb rule: Hold the current-carrying wire in the right hand with the thumb stretched along the direction of the current; the curled fingers then point in the direction of the magnetic field lines round the wire.
(a)
Step 1 — Find the direction of the current.
In the diagram the longer plate of the cell, its positive terminal, is on the right. So when the key K is closed, the current flows from the positive terminal through K, up to B, and along the wire from B to A. B is the north end and A the south end, so the current flows from north to south.
Step 2 — Find the field below the wire.
Hold the wire in the right hand with the thumb pointing south, along the current. The fingers curl round the wire and, just below it, they point towards the east.
Step 3 — Find the deflection.
The north pole of the needle is pushed along this field, so the north end of the needle deflects towards the east. In the diagram (a top view with east at the bottom of the page), the pointed north end turns towards the bottom of the page.

The figure views the wire end-on from A (the south end), so the current B → A comes towards the viewer: the field lines circle the wire anticlockwise, pointing west above the wire and east below it.
(b)
Step 4 — Explain the deflection.
The current in the wire produces a magnetic field round it. Just below the wire this field is at right angles to the wire, that is, east–west, so it pushes the poles of the needle sideways and turns it from its north–south position.
(c)
Step 5 — Move the needle above the wire.
Just above the wire the field lines run the opposite way, towards the west. So the deflection is reversed: the north end of the needle now deflects towards the west.
(d)
Step 6 — Name a device.
This is the magnetic effect of current. An electromagnet, as used in an electric bell, works on this principle. (Early current detectors, needle galvanometers, also worked by the deflection of a magnetic needle near a current.)
Watch out: The field below a wire is opposite to the field above it, so moving the needle from below to above reverses the deflection.
Therefore, (a) the north end of the needle deflects towards the east, (b) because the current in AB sets up a magnetic field round it which acts on the needle, (c) with the needle above AB the deflection is reversed (the north end turns west), and (d) an electromagnet, as in an electric bell, works on this principle.