Let us consider $$s_1$$ and $$ s_2$$ as the cross-section area of the lower and upper piston respectively.
Let $$P_o$$ be the atmospheric pressure and P be the gas pressure.At equilibrium, the downward force and upward forces balances,
i.e., $$P_o + Ps_1 + mg = Ps_2 + P_{o}s_{1} $$ ($$Force = Pressure \times Area$$}
$$ P = P_{o} + \dfrac{mg}{s_1 - s_2}$$ -- (1)
Let $$l_1$$ and $$l_2$$ be the length of string in lower and upper section.
Initial volume of the gas = $$ l_1 s_1 + l_2 s_2$$
When the pistons shifts by a distance $$x$$,
Final volume = $$(l_1 - x)s_1 + (l_2 + x)s_2$$
We have $$ PV = RT$$. Applying this before heating and after heating the gas,
$$P(l_1 s_1 + l_2 s_2) = RT$$ -- (2)
$$P[(l_1 -x)s_1 + (l_2 + x)s_2] = R (T + \Delta T)$$
$$P[(l_1 s_1 + l_2 s_2)+ (s_2 - s_1)x]= R (T + \Delta T)$$
$$[P(l_1 s_1 + l_2 s_2)+ P(s_2 - s_1)x]= R (T + \Delta T)$$
$$P(l_1 s_1 + l_2 s_2)+ P \Delta S x= R (T + \Delta T)$$
Substituting for $$P(l_1 + l_2)$$ from equation 2,
$$RT+ P \Delta S x= R (T + \Delta T)$$
Substituting for $$P$$ from equation 1,
$$RT+ P_{o} + \dfrac{mg}{s_1 - s_2} \Delta S x= R (T + \Delta T)$$
$$\implies \Delta T = \dfrac{1}{R} [P_o + mgx)$$
$$ = \dfrac {1}{8.3} [10^5 \times 5 \times 10^{-2} \times 10 \times 0^{-4} + 5 \times 9.81 \times 5 \times 10^{-2} ]$$
$$ = 0.9$$