The tension T in string 2 is equal to the tension in string 1 when two blocks are connected by a massless string and pulled across a frictionless table, due to the equal accelerations of the blocks.
When blocks A and B are connected by a massless string and pulled across a frictionless table by another massless string, the tension T in both strings must be identical, assuming that the strings are inextensible and do not slack.
This is because the acceleration of both blocks must be the same, represented by |a1| = |a2|, for the motion to be consistent. Therefore, the tension in string 2 is equal to the tension in string 1, regardless of the difference in mass between block A and block B.