Note AcademyNote Academy

Computer Science · May / June 2024 · Paper 21 · Question 5

0478

As printed in the paper

The question as text

Write the pseudocode statements to perform this task: • accept the input of a whole number from 1 to 4 inclusive • use a CASE statement to: ○ output the number (1 to 4 inclusive) that was entered ○ output the word “ERROR” if a 1 to 4 inclusive number was not entered. [5]

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

One mark per mark point

MP1 Correct input statement with appropriate variable

MP2 Elements of selection statement present – CASE OF ENDCASE

MP3 At least one correct branch in the case statement

MP4 All branches from 1 to 4 correct

MP5 Correct use of OTHERWISE with correct output.

For example:

INPUT Number

CASE OF Number

1 : OUTPUT Number

2 : OUTPUT Number

3 : OUTPUT Number

4 : OUTPUT Number

OTHERWISE OUTPUT "ERROR"

ENDCASE

Or

INPUT Number

CASE OF Number

1 : OUTPUT 1

2 : OUTPUT 2

3 : OUTPUT 3

4 : OUTPUT 4

OTHERWISE OUTPUT "ERROR"

ENDCASE

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.