As we know that from first law of thermodynamics we have
[tex]Q = \Delta U + W[/tex]
here we know that
Q = heat given to the system
W = work done by the system
[tex]\Delta U[/tex] = change in internal energy of the system
now we will have
Q = 1000 J
[tex]U_i = 2000 J[/tex]
Work done by the piston = 500 J
so work done by system of gas = -(work done by piston)
[tex]W_g = -500 J[/tex]
now from above equation we have
[tex]1000 J = - 500 + \Delta U[/tex]
[tex]\Delta U = 1500 J[/tex]
now we know that
[tex]\Delta U = U_f - U_i[/tex]
[tex]U_f - 2000 = 1500 J[/tex]
[tex]U_f = 3500 J[/tex]
So final internal energy of the gas is 3500 J while initial internal energy is given as 2000 J