Past-paper question · 2024 May-June · Paper 22 · Q11

Question 11 2024 · May-June · Paper 22 · 15 marks

Original past-paper question for 11
Original past-paper question for 11
Original past-paper question for 11
Original past-paper question for 11
Original past-paper question for 11
Reveal official mark-scheme answer Official mark-scheme answer for 11

Official answer for Question 11

✓
Data Structures required with names as given in the scenario:

Question 15

✓
Arrays or lists Grid
✓
Requirements (techniques)
✓
R1 Set up game – generate random cell, clear all other cells in array, set player start position and start player moves
✓
counter (iteration, use of arrays and library routines (round and random))
✓
R2 Input and check move – is it valid? (input, output, iteration and selection)
✓
R3 Decide outcome – has move found the X? If so, give appropriate output. If not increment counter and continue. If 10
✓
moves exceeded, give appropriate output (use of arrays, iteration, selection and output).
✓
Example 15-mark answer in pseudocode
✓
// Set up game
✓
FOR Row 1 TO 5
✓
FOR Column 1 TO 5
✓
Grid[Row, Column] ''// set grid cells to be empty
✓
NEXT Column
✓
NEXT Row
✓
0478/22
✓
Cambridge IGCSE – Mark Scheme
✓
May/June 2024
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s24_ms_22.pdf →

Show text version of question

Question 11

A
one-player game uses the two-dimensional (2D) array Grid[] to store the location of a secret

cell to be found by the player in 10 moves. Each row and column has 5 cells.

Start Grid[1,1]

At the start of the game:

  • The program places an ‘X’ in a random cell (not in Grid[1,1]) and empties all the other
  • cells in the grid.

  • The player starts at the top left of the grid.
  • The player has 10 moves.

During the game:

  • The player can move left, right, up or down by one cell and the move must be within the grid.
  • “You Win” is displayed if the player moves to the cell with ‘X’ and has played 10 moves or
  • less.

  • “You Lose” is displayed if the player has made 10 moves without finding the ‘X’.

Write a program that meets these requirements.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays or variables; you may assume that this has already been done.

All inputs and outputs must contain suitable messages.

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

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

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

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

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

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

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

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

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

Question 13

, ,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Question 14

, ,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[15]

,

,

Question 15

Question 16

, ,

reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.

To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series.

Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.

Topic relevance

Why this question appears here

98% assigned-topic match · Programming › Arrays

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 0478_s24_qp_22.pdf

Keep practising this topic