Consider the following high level program segment. Give the contents of the…

PYQ GATE 1995Modified — slightly modified from the official paper; see the solution

Consider the following high level program segment. Give the contents of the memory locations for variables W, X, Y and Z after the execution of the program segment. The values of the variables A and B are 5 CH and 92H, respectively. Also indicate error conditions if any.

var

A, B, W, X, Y :unsigned byte;

Z :unsigned integer, (each integer is represented by two bytes)

begin

X :=A+B

Y :=abs(A-B);

W :=A-B

Z :=A*B

End;

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…