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

Question 3(b)(ii) 2016 · May-June · Paper 22 · 8 marks

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

Official answer for Question 3

Part (b)

(ii)

(ii)

Max[8]

✓
PROCEDURE CheckForStartOfWord(Puzzle, ThisRow, ThisColumn,
✓
Across, Down)
✓
Across ← FALSE // will change to TRUE
✓
// if a word across starts in this square
✓
Down ← FALSE
✓
(1)
✓
IF Puzzle[ThisRow, ThisColumn] = WHITE
✓
(1)
✓
THEN
✓
// this square is white
✓
// check for sequence across
✓
IF ThisColumn < 11 // check not in last column
✓
THEN
✓
// check this is the first column or a black square to the left
✓
IF (ThisColumn = 1
✓
OR Puzzle[ThisRow, ThisColumn - 1] = BLACK)
✓
AND (Puzzle[ThisRow, ThisColumn + 1] = WHITE)
✓
(1)
✓
THEN
✓
Across ← TRUE
✓
ENDIF
✓
(1)
✓
ENDIF
✓
// check for sequence down
✓
IF ThisRow < 11 // check not in last row
✓
THEN
✓
// check this is the first row or a black square above
✓
IF (ThisRow = 1
✓
(1)
✓
OR Puzzle[ThisRow - 1, ThisColumn] = BLACK)
✓
(1)
✓
// check that the square below is white
✓
AND (Puzzle[ThisRow + 1, ThisColumn] = WHITE)
✓
(1)
✓
THEN
✓
Down ← TRUE
✓
(1)
✓
ENDIF
✓
ENDIF
✓
ENDIF
✓
ENDPROCEDURE

Mark scheme 9691_s16_ms_22.pdf →

Show text version of question

Question 3

Part (b)

(ii)

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 The next stage for Zara is to design a procedure that numbers the relevant white squares.

A
word begins in a square if the square is:
  • a white square, and
  • the first of a sequence of at least 2 white squares

° across or ° down Zara starts to write the pseudocode for the procedure CheckForStartOfWord. This will check whether a square at ThisRow and ThisColumn is the start of a word.

(ii)

Complete the pseudocode:

PROCEDURE CheckForStartOfWord(Puzzle, ThisRow, ThisColumn, Across, Down) Across ← FALSE // will change to TRUE // if a word across starts in this square Down ← ........................................................................................................................................... IF Puzzle[ThisRow, ThisColumn] = .................................................................................... THEN // this square is white // check for sequence across IF ThisColumn < 11 // check not in last column THEN // check this is the first column or a black square to the left IF (ThisColumn = 1 OR Puzzle[ThisRow, ThisColumn - 1] = BLACK) // check that the square to the right is white AND (Puzzle[............................................................................] = WHITE) THEN Across ← TRUE ................................................................................................................................. ENDIF // check for sequence down IF ThisRow < 11 // check not in last row THEN // check this is the first row or a black square above IF (ThisRow = ................................................................................................... OR Puzzle[ ............................................................................... ] = BLACK) // check that the square below is white AND ( ..............................................................................................................) THEN Down ← .................................................................................................... ENDIF ENDIF ENDIF ENDPROCEDURE

[8]

Question 11

Topic relevance

Why this question appears here

82% assigned-topic match · Hardware › Logic gates and logic circuits

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