Question 1(b)(i) 2019 · May-June · Paper 23 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (b)
(i)
Question 5
Question 90
Question 11
Show text version of question
Question 1
Part (b)
(i)
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
(i)
Program variables have values as follows:
Variable Value MeltingPoint 180.5 Soluble FALSE Attempt 3 ProductName "Mushroom Compost" Version 'A' ProductID "BZ27-4"
Evaluate each expression in the following table.
If an expression is invalid, write ERROR.
For the built-in functions list, refer to the Appendix on page 18.
Expression Evaluates to STRING_TO_NUM(MID(ProductID, 3, 2)) + 4 INT(MeltingPoint / 2) Soluble AND Attempt > 3 LENGTH(ProductID & NUM_TO_STRING(MeltingPoint)) RIGHT(ProductName, 4) & MID(ProductName, 5, 4)
Why this question appears here
71% 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 9608_s19_qp_23.pdf
