(a) The relation between density $(d)$ and acceleration due to gravity $(g)$ is
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ d = \frac{3g}{4\pi R_{e}G}$
$\therefore\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \frac{d_{1}}{d_{2}} = \frac{g_{1}}{r_{1}} \times \frac{r_{2}}{g_{2}}$
$\Longrightarrow \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \frac{g_{1}}{g_{2}} = \frac{d_{1}r_{1}}{d_{2}r_{2}}$