(a) How the egret benefits: as the cattle move, they "stir up and flush out insects from the vegetation that otherwise might be difficult for the egrets to find and catch". The egret gets food more easily (+).
Why it is not parasitism: a parasite takes its food from the host and harms it. The egret eats the insects, not anything from the cattle's bodies. The cattle graze as usual and are neither harmed nor benefited (0). The signs are (+, 0), which is commensalism; parasitism would be (+, −).
(b) Barnacles + (they get a surface to grow on), whale 0. NCERT: the barnacles "benefit while neither the mango tree nor the whale derives any apparent benefit." The barnacles do not feed on the whale or harm it, so the whale is not a host that is harmed. It is commensalism (+, 0), not parasitism (+, −).
