Past-paper question · 2016 May-June · Paper 22 · Q3(f)

Question 3(f) 2016 · May-June · Paper 22 · 7 marks

Original past-paper question for 3(F)
Original past-paper question for 3(F)
Original past-paper question for 3(F)
Original past-paper question for 3(F)
Original past-paper question for 3(F)
Original past-paper question for 3(F)
Original past-paper question for 3(F)
Reveal official mark-scheme answer Official mark-scheme answer for 3(F)

Official answer for Question 3

Part (f)

Part (f)

Max[7]

✓
FUNCTION CountSquaresAcross(Puzzle, ThisRow, ThisColumn) RETURNS
✓
INTEGER
✓
DECLARE WordLength : INTEGER
✓
WordLength ← 2 // this was the minimum word length
✓
WHILE Puzzle[ThisRow, ThisColumn + WordLength] = WHITE
✓
AND (ThisColumn + WordLength) <= 11
✓
WordLength ← WordLength + 1
✓
ENDWHILE
✓
RETURN WordLength
✓
ENDFUNCTION
✓
Mark as follows:
  • declaration of local variable
  • initialise counter
  • loop using WHILE or REPEAT
  • increment counter
  • check for white square
  • check for right edge of puzzle
  • return counter
  • end function

Mark scheme 9691_s16_ms_22.pdf →

Show text version of question

Question 3

Part (f)

Question 3

A crossword puzzle is based on a grid made up of white and black squares. The white squares are

to be filled with letters to form words across the grid and down the grid.

The crossword puzzle designer provides clues for each word. Words consist of at least 2 letters.

The square where a word starts, across or down, is numbered. The numbering starts at the top left of the grid and is consecutive, row by row.

Here is an example of a crossword grid:

1 2 3 4 5 6

7 8

9 10 11

12 13 14

Question 15

16 17

18 19

Part (f)

One of Zara’s friends suggests that the number of squares for a word should be counted.

Zara decides that she needs a function to count the number of squares for a word going across. She needs another function to count the number of squares for a word going down.

The program will call the function CountSquaresAcross when ThisRow and ThisColumn refer to a square that is the start of a word across.

Write pseudocode for the function CountSquaresAcross. Declare any local variables required.

FUNCTION CountSquaresAcross(Puzzle, ThisRow, ThisColumn) RETURNS INTEGER

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

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

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

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

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

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

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

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

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

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

[7]

Question 16

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 International Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after the live examination series.

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

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_s16_qp_22.pdf

Keep practising this topic