Past-paper question · 2019 May-June · Paper 23 · Q1(b)(i)

Question 1(b)(i) 2019 · May-June · Paper 23 · 6 marks

Original past-paper question for 1(B)(I)
Original past-paper question for 1(B)(I)
Original past-paper question for 1(B)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 1(B)(I)

Official answer for Question 1

Part (b)

(i)

Question 5

✓
Expression
✓
Evaluates to
✓
STRING_TO_NUM(MID(ProductID, 3, 2)) + 4
✓
31.0 / 31
✓
INT(MeltingPoint / 2)

Question 90

✓
Soluble AND Attempt > 3
✓
FALSE
✓
LENGTH(ProductID & NUM_TO_STRING(MeltingPoint))

Question 11

✓
RIGHT(ProductName, 4) & MID(ProductName, 5, 4)
✓
"postroom"
✓
Quotes for row 5 only

Mark scheme 9608_s19_ms_23.pdf →

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)

[5]
Topic relevance

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

Keep practising this topic