The reactions that take place are as follows:
For Cl- solution:
BaCl2(aq) + 2NaCl(aq) → No reaction (all compounds are soluble)
For SO42- solution:
BaCl2(aq) + Na2SO4(aq) → BaSO4(s)↓ + 2NaCl(aq)
So, the formation of a white precipitate indicates the presence of SO42- ions, while the absence of a precipitate suggests the presence of Cl- ions in the solution.