4.
(a)
Trace through the execution of the following algorithm and draw the output in your answer
booklet, exactly as it would be generated by the algorithm. You should carefully note the
following:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
.
.
begin
end
printSpaces (n) prints n spaces from the current cursor position
print continues output on the current line from the current cursor position
println terminates output on the current line at the current cursor position.
Any subsequent output begins on a new line (e.g. line 21)
println (output-list) outputs 'output-list' on the current line and then places
the cursor at beginning of the following line (e.g. line 4)
SIZE = 10
printSpaces (SIZE)
println ('*')
j= SIZE-2
r = 1
while (j>= 5) do
begin
printSpaces (+1)
print (¹ * ¹)
printSpaces (r)
println ('*')
j=j-1,
r=r+2
end
for j = 1 to 5 do
begin
printSpaces (SIZE)
println (*¹)
end
printin



Answer :

Other Questions