Past-paper question · 2023 May-June · Paper 22 · Q7(c)

Question 7(c) 2023 · May-June · Paper 22 · 9 marks

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

Official answer for Question 7

Part (c)

✓
One mark for place in algorithm (max one)

Question 4

✓
around lines 05 and 06
✓
line 07
✓
(immediately) after the input of the number
✓
Three marks pseudocode
✓
One mark for each point (max three)
✓
Use of REPEAT … UNTIL // any working loop structure
✓
check for >0 // >=0
✓
check for <10 // >9
✓
check for whole number
✓
check for -1
✓
check for length of digit <> 1
✓
Example
✓
REPEAT
✓
OUTPUT "Enter a digit "
✓
INPUT Number[Counter]
✓
UNTIL Number[Counter] = Round(Number[Counter],0) AND ((Number[Counter] = -1) OR
✓
(Number[Counter] > 0 AND Number[Counter] < 10))
✓
0478/22
✓
Cambridge IGCSE – Mark Scheme
✓
May/June 2023
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 0478_s23_ms_22.pdf →

Show text version of question

Question 7

Part (c)

Question 7

An algorithm has been written in pseudocode to calculate a check digit for a four-digit number.

The algorithm then outputs the five-digit number including the check digit. The algorithm stops when –1 is input as the fourth digit.

01 Flag FALSE 02 REPEAT 03 Total 0 04 FOR Counter 1 TO 4 05 OUTPUT "Enter a digit ", Counter 06 INPUT Number[Counter] 07 Total Total + Number * Counter 08 IF Number[Counter] = 0 09 THEN 10 Flag TRUE 11 ENDIF 12 NEXT Counter 13 IF NOT Flag 14 THEN 15 Number[5] MOD(Total, 10) 16 FOR Counter 0 TO 5 17 OUTPUT Number[Counter] 18 NEXT 19 ENDIF 20 UNTIL Flag

Part (c)

The algorithm does not check that each input is a single digit.

Identify the place in the algorithm where this check should occur. Write pseudocode for this check. Your pseudocode must make sure that the input is a single digit and checks for –1

Place in algorithm .....................................................................................................................

Pseudocode ..............................................................................................................................

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

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

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

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

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

[4]
Topic relevance

Why this question appears here

98% assigned-topic match · Algorithm design and problem-solving

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

Keep practising this topic