Past-paper question · 2021 May-June · Paper 23 · Q4(c)

Question 4(c) 2021 · May-June · Paper 23 · 2 marks

Original past-paper question for 4(C)
Original past-paper question for 4(C)
Original past-paper question for 4(C)
Original past-paper question for 4(C)
Reveal official mark-scheme answer Official mark-scheme answer for 4(C)

Official answer for Question 4

Part (c)

✓
•
✓
Syntax error

Question 2

✓
•
✓
Rules of the language are not followed
✓
OR
✓
•
✓
Run-time error
✓
•
✓
Program performs an illegal operation or enters an infinite loop
✓
9608/23
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s21_ms_23.pdf →

Show text version of question

Question 4

Part (c)

Question 4

Study the following pseudocode for a string handling function Check().

Refer to the Appendix on pages 22 and 23 for the list of built-in pseudocode functions and operators.

FUNCTION Check(InString : STRING) RETURNS INTEGER

DECLARE Index, Result, Count : INTEGER DECLARE NextChar : CHAR

Result 0 Count 1

FOR Index 1 TO LENGTH(InString)

NextChar MID(InString, Index, 1) IF (NextChar >= '0' AND NextChar <= '9') OR NextChar = '.' THEN Result Result + 1 ELSE IF NextChar = ',' THEN Count Count + 1 ELSE Result -1 ENDIF ENDIF ENDFOR

IF Count < 3 THEN RETURN -1 ELSE RETURN Result ENDIF

ENDFUNCTION

Question 9

Part (c)

A dry run of a pseudocode algorithm may help to locate logic errors.

Give another type of program error and describe how it can occur.

Type of error .............................................................................................................................

Description ................................................................................................................................

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

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

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

[2]

Question 11

Question 12

Topic relevance

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 9608_s21_qp_23.pdf

Keep practising this topic