Question 13
AQA Computer Science Specimen Paper 1B (8525/1B)GCSE10 marks
On the specification
- 13.1
- 3.1 Fundamentals of algorithms3.2 Programming
- 13.2
- 3.1 Fundamentals of algorithms3.2 Programming
- 13.3
- 3.1 Fundamentals of algorithms3.2 Programming
Question text
13 The following subroutines control the way that labelled blocks are placed in box different columns. BLOCK_ON_TOP(column) returns the label of the block on top of the column given as a parameter. MOVE(source, destination) moves the block on top of the source column to the top of the destination column. HEIGHT(column) returns the number of blocks in the specified column. 13.1 This is how the blocks A, B and C are arranged at the start. Draw the final arrangement of the blocks after the following algorithm has run. MOVE(0, 1) MOVE(0, 2) MOVE(0, 2) [3 marks] 13.2 This is how the blocks A, B and C are arranged at the start. box Draw the final arrangement of the blocks after the following algorithm has run. WHILE HEIGHT(0) > 1 MOVE(0, 1) ENDWHILE MOVE(1, 2) [3 marks] 13.3 Develop an algorithm using either pseudo-code or a flowchart that will move box every block from column 0 to column 1. Your algorithm should work however many blocks start in column 0. You may assume there will always be at least one block in column 0 at the start and that the other columns are empty. The order of the blocks must be preserved. The MOVE subroutine must be used to move a block from one column to another. You should also use the HEIGHT subroutine in your answer. For example, if the starting arrangement of the blocks is: Then the final arrangement should have block B above block A: [4 marks]