Past-paper question · 2014 May-June · Paper 22 · Q2(a)

Question 2(a) 2014 · May-June · Paper 22 · 9 marks

Original past-paper question for 2(A)
Original past-paper question for 2(A)
Original past-paper question for 2(A)
Reveal official mark-scheme answer

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 9691_s14_ms_22.pdf →

Show text version of question

Question 2

Part (a)

Question 2

The teacher wants a new program to test children. A sequence of multiplication questions is

displayed. If a child inputs 3 incorrect answers for a question, the program outputs the number of questions the child answers correctly. Then the program stops. The program design uses the following functions and procedures.

Function or procedure name Description Random(X) A function that returns a whole number in the range 1 to X inclusive Display(Number1, Number2) A procedure that produces the output

5×8= ?

when Number1 is 5 and Number2 is 8 CheckAnswerCorrect(Number1, Number2) The procedure from Question 1(d)

TestScoreTotal A function that returns the number of questions answered correctly

Part (a)

Complete the pseudocode:

FUNCTION TestScoreTotal RETURNS

DECLARE AnswerCorrect, : BOOLEAN

DECLARE , , : INTEGER

// initialise Score

Finish FALSE

REPEAT

Number1 // generate two

Number2 // numbers

Display(Number1, Number2)

AnswerCorrect CheckAnswerCorrect(Number1, Number2)

IF // was answer correct?

THEN Score Score + 1

ELSE // flag set to stop program

ENDIF

UNTIL // is flag set?

RETURN // return the number of

// questions answered correctly

ENDFUNCTION

[9]

Question 7

Topic relevance

Why this question appears here

82% 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 9691_s14_qp_22.pdf

Keep practising this topic