I am trying to understand the answer to this question. If a negatively charged rod is brought near the knob at the top of the electroscope then the electrons in the electroscope will be pushed to the end with the leaves (the knob will assume a net positive charge). If the aim is to finish with a positively charged electroscope then a grounding wire / finger would have to be applied near the leaf end of the electroscope to give the excess electrons a path to earth.
The given answer does not specify which part of the electroscope is grounded, but since only the knob is accessible, the rest being in the glass bulb, the implication is that the knob is grounded. It seems to me that grounding the knob would cause electrons to flow from earth onto the positively knob and when the ground is broken and the rod removed the result would be a negatively charged electroscope.