Question: how q is path dependent?
Answer: Both work and heat are energy changes that happen during the process and when taken together, they compensate for each other so that the change in both, combined (q + w), does not depend on path. This function is called the change in internal energy, .