Question 3(f) 2015 · May-June · Paper 21 · 5 marks
Question 3
Part (f)
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.
Part (f)
The subroutine DisplayGrid is to output the state of play at any time.
For example, after three turns the display should look like:
: : O : O X : : :
where the character ‘:’ shows an empty cell.
Question 3(f) continues on page 12.
Question 12
Write program code for the subroutine algorithm represented by the flowchart:
352&('85( 'LVSOD\*ULG
(PSW\&HOO ®¯
)255RZ
Question 72
/LQH ®¯
)25&ROXPQ
Question 72
*ULG>5RZ&ROXPQ@ 1R (PSW\&HOO " The operator concatenates <HV two strings.
/LQH/LQH ®¯ /LQH/LQH ® ¯ ®¯
*ULG>5RZ&ROXPQ@
1R &ROXPQ " <HV
287387 /LQH
1R 5RZ "
<HV
(1'352&('85(
Question 13
Programming language ............................................................................................................
Code .........................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
Question 14
Reveal official mark-scheme answer
Official answer for Question 3
Part (f)
Part (f)
Why this question appears here
71% assigned-topic match · Algorithm design and problem-solving › Algorithms
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
