Past-paper question · 2015 May-June · Paper 22 · Q3(c)(ii)

Question 3(c)(ii) 2015 · May-June · Paper 22 · 1 mark

Question 3

Part (c)

(ii)

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

(ii)

State one benefit of top-down design.

...........................................................................................................................................

......................................................................................................................................

[1]
Reveal official mark-scheme answer Official mark-scheme answer for 3(C)(II)

Official answer for Question 3

Part (c)

(ii)

(ii)

Easier to solve (by breaking down into sub-problems)

✓
Can focus on one part at a time
✓
easier to produce module code
[1]

Mark scheme 9691_s15_ms_22.pdf →

Topic relevance

Why this question appears here

82% 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_22.pdf

Keep practising this topic