Answer
See the detailed answer below.
Work Step by Step
We know that $n_1$ is the moles of the monatomic gas and $n_2$ is the moles of the diatomic gas.
We know that the thermal energy of the system is given by
$$(E_{th})_{tot,i}=E_{th,1}+E_{th,2}$$
where $E_{th,1}$ is for the monatomic gas and is given by $3nRT/2$ while $E_{th,2}$ is for the diatomic gas and is given by $5nRT/2$.
Hence,
$$(E_{th})_{tot,i}=\dfrac{3n_1RT_{1i}}{2}+\dfrac{5n_2RT_{2i}}{2}\tag 1$$
And the final thermal energy is given by
$$(E_{th})_{tot,f}=\dfrac{3n_1RT_{1f}}{2}+\dfrac{5n_2RT_{2f}}{2}$$
We know that finally $T_{2f}=T_{1f}=T_f$;
$$(E_{th})_{tot,f}=\dfrac{RT_{f}}{2}(3n_1+5n_2)\tag 2 $$
And since the system is perfectly isolated, the total thermal energy of the system is constant and conserved.
Hence, equation (1) and (2) are equal.
$$\dfrac{\color{red}{\bf\not} RT_{f}}{ \color{red}{\bf\not} 2}(3n_1+5n_2)=\dfrac{3n_1\color{red}{\bf\not} RT_{1i}}{ \color{red}{\bf\not} 2}+\dfrac{5n_2\color{red}{\bf\not} RT_{2i}}{ \color{red}{\bf\not} 2} $$
Solving for $T_f$;
$$ T_{f}= \dfrac{3n_1 T_{1i} + 5n_2 T_{2i} }{ (3n_1+5n_2)}\tag 3$$
Now we can find the final thermal energy of each gas;
For gas 1;
$$(E_{th})_{1f}=\frac{3}{2}n_1RT_f$$
Plugging from (3);
$$(E_{th})_{1f}=\frac{3}{2}n_1R \dfrac{3n_1 T_{1i} + 5n_2 T_{2i} }{ (3n_1+5n_2)}$$
$$(E_{th})_{1f}=3n_1 \dfrac{\overbrace{\frac{3}{2}n_1 RT_{1i}}^{E_{th,1i}} + \overbrace{\frac{5}{2}n_2R T_{2i}}^{E_{th,2i}} }{ (3n_1+5n_2)}$$
$$ \boxed{({E_{th})_{1f}=\dfrac{3n_1 }{3n_1+5n_2}\left(E_{th,1i}+E_{th,2i}\right)}}$$
For gas 2;
$$(E_{th})_{1f}=\frac{5}{2}n_1RT_f$$
And by the same approach, we got
$$ \boxed{({E_{th})_{1f}=\dfrac{5n_2 }{3n_1+5n_2}\left(E_{th,1i}+E_{th,2i}\right)}}$$
_________________________________________________
b) See equation (3);
$$\boxed{ T_{f}= \dfrac{3n_1 T_{1i} + 5n_2 T_{2i} }{ (3n_1+5n_2)}}$$
_________________________________________________
c) First of all, we need to find the number of moles of each gas:
$$n_1=n_{He}=\dfrac{m}{M}=\dfrac{2}{4}=\bf 0.5\;\rm mol$$
$$n_2=n_{O_2}=\dfrac{m}{2M_O}=\dfrac{8}{2(16)}=\bf 0.25\;\rm mol$$
The final temperature is given by equation (3) above;
$$ T_{f}= \dfrac{3n_1 T_{1i} + 5n_2 T_{2i} }{ (3n_1+5n_2)} $$
Plugging the known;
$$ T_{f}= \dfrac{3(0.5) (300) + 5(0.25)(600) }{ (3(0.5)+5(0.25))} =\color{red}{\bf 436}\;\rm K$$
And since the final temperature is greater that that of the helium and less than that of the oxygen, then the heat flows from the oxygen to the helium.
This amount of heat transferred is given by the change of the thermal energy of any gas of them (since the volumes are constant and the work done on the gas is then zero).
$$Q_{He}=\Delta E_{th,1}=\frac{3}{2}n_1R\Delta T_1$$
Plugging the known;
$$Q_{He}= \frac{3}{2}(0.5)(8.31)( 436-300)$$
$$Q_{He}=\color{red}{\bf 848}\;\rm J$$