Question 3(c)(i) 2015 · May-June · Paper 21 · 1 mark
Question 3
Part (c)
(i)
Question 3
A board game is designed for two players, O and X.
At the beginning, all cells of a 3 x 3 grid are empty.
The players take turns in placing their marker in an empty cell of the grid; player O always starts.
The game ends when one player completes a row, column or diagonal or the grid is full.
Here is one example after three turns:
O
O X
Ali wants to write a program to play the game. Ali uses the top-down design approach for his overall program solution.
His design is as follows:
01 GameEnd ← FALSE 02 CurrentPlayer ← 'O' 03 CALL DisplayGrid() 04 05 REPEAT 06 CALL PlayerTakesTurn(CurrentPlayer) 07 CALL DisplayGrid() 08 IF HasPlayerWon() = TRUE 09 THEN 10 GameEnd ← TRUE 11 OUTPUT "Player", CurrentPlayer, "has won" 12 ELSE 13 IF GridFull() = TRUE 14 THEN 15 GameEnd ← TRUE 16 OUTPUT "Draw" 17 ELSE 18 CALL SwapPlayer(CurrentPlayer) 19 ENDIF 20 ENDIF 21 UNTIL GameEnd = TRUE
(i)
Identify one feature in the above pseudocode which indicates that top-down design has
been used.
...........................................................................................................................................
......................................................................................................................................
Reveal official mark-scheme answer
Official answer for Question 3
Part (c)
(i)
Part (c)
(i)
Mark as follows:
- parameter
- returns data type
- declaration of local variable(s)
- Initialisation(s)
- loop
- Boolean statement
- updating of largest so far
- store index of where largest so far was found
- return index of most frequent letter
Why this question appears here
72% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9691_s15_qp_21.pdf
