Is it necessary to connect all power pins to power pic16f877a
They have the same name so they share the same function, However, IC's with small packages can have multiple power supply pins with the same function which are not connected together. This is done, for example, to prevent EMC problems. Ground pins are always connected together but may also influence behaviour (stability, error, noise) of certain analog or fast internal components (ADC's, clocks).