Answer: The spheres are charged through induction.
Explanation: When the negatively charged rod is brought near the end of sphere A, the electrons in rod repel those at A and force them to Sphere B. So sphere A having lost electrons is now positively charged and B having received electrons becomes negatively charged.
NOTE: The Spheres have been charged by electrostatic induction because the negatively charged rod did not make a direct contact with the conducting spheres A and B. It was just brought close to the spheres.