Question 1(a) 2019 · May-June · Paper 23 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (a)
Question 6
Show text version of question
Question 1
Part (a)
Question 1
The following pseudocode searches for the longest run of identical characters in the array
Message.
DECLARE Message : ARRAY[1:100] OF CHAR
PROCEDURE Search()
DECLARE Index : INTEGER DECLARE ThisChar : CHAR DECLARE ThisRun : INTEGER DECLARE LongRun : INTEGER
ThisChar Message[1] ThisRun 1 LongRun 1
FOR Index 2 TO 100
IF Message[Index] = ThisChar THEN ThisRun ThisRun + 1 ELSE ThisChar Message[Index] IF ThisRun > LongRun THEN LongRun ThisRun ENDIF ThisRun 1 ENDIF
ENDFOR
OUTPUT "The longest run was " , LongRun
ENDPROCEDURE
Question 3
Part (a)
Draw a program flowchart to represent the procedure Search().
Variable and array declarations are not required in program flowcharts.
Question 4
Why this question appears here
71% 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 9608_s19_qp_23.pdf
