(a) Use: a shell produces, inside itself, a constant potential equal to its surface value, and outside, the potential of a point charge at the centre.
Vsphere=k(aq+bQ),Vshell=kbq+Q

(b) Earthing sets the sphere's potential to zero. Let its new charge be q′ (the shell still carries Q):
k(aq′+bQ)=0⇒q′=−baQ
The sphere does not lose all its charge. It must carry a charge of the opposite sign to Q, of size baQ, to cancel the potential that the outer shell creates inside it.