Consider the following Pascal program skeleton: program sort (...); var a, x,…
PYQ GATE 1999Modified — slightly modified from the official paper; see the solution
Consider the following Pascal program skeleton:
program sort (...);
var a, x, ...;
procedure readarray;
var i, ...;
begin
... := ... a ...
end;
procedure exchange (...);
begin
... := ... a ...;
... := ... x ...;
end;
procedure qsort (...);
var k, v, ...;
function partition (...) ...;
var i, j, ...;
begin
... := ... a ...;
... := ... v ...;
end;
begin
...
end;
begin
...
end.Assume that at a given point in time during program execution, the following procedures are active: sort, qsort(1,9), qsort(1,3), partition(1,3), exchange(1,3).
Show snapshots of the runtime stack with access links after each of the activations.
Sign up free to check your answer
Sign up freeLoading lesson…

