Answer
(a) $T=1.09\times10^4N$
(b) $T=544N$
Work Step by Step
The tension $T$ in the coupling is the force that pulls the cars and causes it to have acceleration. If we take $\sum M$ to be the total mass of all the cars behind a specific coupling, according to Newton's 2nd Law, $$T=\sum Ma$$
(a) The coupling between 30th and 31st cars pulls 20 cars behind it, which has the total mass $$\sum M=20\times6.8\times10^3=1.36\times10^5kg$$
Therefore, $$T=(1.36\times10^5kg)\times(8\times10^{-2}m/s^2)=1.09\times10^4N$$
(b) The coupling between 49th and 50th cars pulls only 1 car behind it, which has the total mass $$\sum M=6.8\times10^3kg$$
Therefore, $$T=6.8\times10^3kg\times8\times10^{-2}m/s^2=544N$$