Answer
See the detailed answer below.
Work Step by Step
As we see in the given graph, the gas undergoes two processes which are:
$\bullet$ 1) A compression-isothermal process:
The work done on the gas in the first process is given by
$$W=-\int_i^f PdV$$
where $dV$ is negative since the gas compresses.
Thus, the work done on the gas here is positive.
$$W=\int PdV$$
Thus the energy transfers out from the gas which means that $Q$ is negative.
$\bullet\bullet$ 2) An isochoric process:
The work done in this process is zero since the volume of the gas remains constant.
And in this case,
$$\dfrac{ P_2\color{red}{\bf\not} V_2}{T_2}=\dfrac{ P_3\color{red}{\bf\not} V_3}{T_3}$$
Hence,
$$\dfrac{P_2}{P_3}=\dfrac{T_2}{T_3}$$
where $P_2\gt P_3$, as seen in the given graph,
so
$$\dfrac{P_2}{P_3}=\dfrac{T_2}{T_3}\gt 1$$
So,
$$T_2\gt T_3$$
This means that the final temperature is less than the initial temperature. Thus, the energy escapes again from the system which means that $Q\lt 0$ is negative.
See the bar chart of this equation below.
To proceed with this process, we need to:
1- Let the piston moves freely by unlocking the pin.
2- ut the ice in contact with the bottom of the cylinder to compress the ice volume. The gas temperature rises due to the compression but it losing this energy immediately due to the ice contact which maintains the temperature constant.
3- And to increase pressure, to have a result of $PV=\rm constant$, we need to add masses on the top of the piston
4- When the piston reaches volume $V_2$, plug the locking pin to maintain the gas volume constant.
5- The ice will remain in touch with the cylinder until the pressure drops to the initial pressure again.
---