If push and pop instructions each require 5 bytes of storage , is given in the question, there are in total 7 push and pops operations, so total cost 7*5= 35 Bytes
There are 7 pushes and pops for a cost of 35 bytes, plus 3 arithmetic instructions, for a total of 38 bytes. which contradict option I .
After Instruction |
Stack Contains |
New Variables |
push b |
b |
|
push x |
b, x |
|
add |
b + x |
|
pop c |
|
c = b + x; |
push c |
b + x |
c = b + x; |
push y |
b +x , y |
c = b + x; |
add |
b + x + y |
c = b + x; |
push c |
b + x + y ; b + x
|
c = b + x; |
sub |
y |
c = b + x; |
pop z |
|
c = b + x; z= y |
$$\begin{array}{|c|c|c|} \hline \textbf{After Instruction} & \textbf{Stack Contains} & \textbf{New Variables} \\ \hline \text{push b} & b & \\ \hline \text{push x} & b,x & \\ \hline \text{add} & b+x & \\ \hline \text{pop c} & & c = b +x; \\ \hline \text{push c} & b+x & c = b+x; \\ \hline \text{push y} & b+x,y & c = b+x; \\ \hline \text{add} & b+x+y & c = b+x; \\ \hline \text{push c} & b+x+y\:;b+x & c = b+x; \\ \hline \text{sub} & y & c=b+x; \\ \hline \text{pop z} & & c=b+x\:;z=y \\ \hline \end{array}$$
so you can see it clearly from above table that At the end of execution, z contains the same value as y. which supports option II .
At the end of execution, the stack is empty. it is also true which supports option III
so option II and III is true.