J.R. S. answered 10/08/20
Ph.D. University Professor with 10+ years Tutoring Experience
∆E = q + w
q = +40 kJ (+ because heat is absorbed)
w = -11 kJ (- because the system is doing work on the surroundings)
∆E = +40 kJ + (-11 kJ) = +29 kJ (you can omit the kJ in your answer)