You have quoted molar heat capacities from your data book but you have used #m# for mass in your expression for #Q#.

So we must work in moles and then convert back to grams using the idea that no. moles = mass/mass of 1 mole

Or in symbols:

#n=m/M_r#

So:

#Q=nxxC_vxxDeltaT#

Note that #n# is the no. moles.

Applying this first to helium:

The #M_r# of helium is 4. (Same as the #A_r#).

So from our expression for #n# we can write:

#Q=(2)/(4)xx12.5xxDeltaT " "color(red)((1))#

Now for oxygen:

The #M_r# of #O_2# is 32 so:

#Q=(m)/(32)xx20.9xxDeltaT " "color(red)((2))#

Now we can put #color(red)((1))# equal to #color(red)((2))rArr#

#2/4xx12.5xxcancel(DeltaT)=m/32xx20.9xxcancel(DeltaT)#

#:.m=(0.5xx12.5xx32)/(20.9)=9.56"g"#

(I have used approximate #M_r# values. You should use the ones you are given)