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

Question 3(c)(iv) 2015 · May-June · Paper 22 · 2 marks

Question 3

Part (c)

(iv)

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

(iv)

Ali has written the pseudocode with features that make it easier to understand.

State two such features.

Feature 1 ...........................................................................................................................

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

Feature 2 ...........................................................................................................................

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

[2]
Reveal official mark-scheme answer Official mark-scheme answer for 3(C)(IV)Official mark-scheme answer for 3(C)(IV)

Official answer for Question 3

Part (c)

(iv)

(iv)

✓
indentation
✓
•
✓
meaningful identifier/variable names
✓
•
✓
keywords in capitals
✓
•
✓
inclusion of white space
✓
•
✓
initialising variables
✓
•
✓
one statement per line
✓
•
✓
use of functions/procedures with meaningful identifiers // use of structured
✓
constructs
✓
[max 2]
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International AS/A Level – May/June 2015
✓
9691

Question 22

Mark scheme 9691_s15_ms_22.pdf →

Topic relevance

Why this question appears here

99% 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