Answer
When a gas expands, w is negative.
When a gas contracts, w is positive.
q is positive and w is negative in the process of boiling water.
Work Step by Step
w, or work, is defined as any action or change in volume on the system or surroundings. Therefore, when a gas expands, the gas is increasing in volume and does work towards the surroundings giving it a negative w value. Similarly, when a gas contracts, the surroundings are doing work on the gas making it contract; therefore, w is positive in this example.
When we boil water, we are transferring heat to the system making q positive. However, the volume of the system increases, with the transition from liquids to gas, and acts against the surroundings. Therefore, w is negative.