Correct answer: If either the rope is not accelerated or is massless
Tension is uniform in a rope if there is no need to accelerate different parts of the rope relative to each other, which happens when the rope is massless or when it is not accelerating. If the rope has mass and is accelerating, different sections must pull on each other differently, so the tension changes along the rope.