The following subroutines control the way labelled blocks are placed in different columns - AQA - GCSE Computer Science - Question 13 - 2021 - Paper 1
Question 13
The following subroutines control the way labelled blocks are placed in different columns.
BLOCK_ON_TOP(column) returns the label of the block on top of the column ... show full transcript
Worked Solution & Example Answer:The following subroutines control the way labelled blocks are placed in different columns - AQA - GCSE Computer Science - Question 13 - 2021 - Paper 1
Step 1
Draw the final arrangement of the blocks after the following algorithm has run.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
After executing the commands, the following arrangements will occur:
After MOVE(0, 1): Block C moves from Column 0 to Column 1.
Column 0
Column 1
Column 2
A
C
B
After MOVE(0, 2): Block A moves from Column 0 to Column 2.
Column 0
Column 1
Column 2
C
A
B
After MOVE(0, 2): There are no more blocks in Column 0 to move, so the arrangement remains the same.