Modified from the official paper: the retype initializes i to zero although…

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

Modified from the official paper: the retype initializes i to zero although the array is indexed 1 through 10; initialize i to 1 so all writes are in bounds. Translate the executable Pascal statements into quadruples. Assume integer and real values require four words each.

Program Test;
var i:integer;
a: array [1...10] of real;
begin i:=1;
While i<=10 do
begin
a[i]:=0;
i:=i+1
end;
end.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…