Note AcademyNote Academy

Computer Science · Oct / Nov 2016 · Paper 22 · Question 4

2210

As printed in the paper

The question as text

IF ... THEN ... ELSE ... ENDIF and CASE ... OF ... OTHERWISE ... ENDCASE are two different conditional statements that you can use when writing pseudocode. Explain, using examples, why you would choose to use each conditional statement. Example 1 Reason for choice Example 2 Reason for choice [6] 9 Question 5 begins on page 10.

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

Show the answer and mark scheme

1 1 Å (1 mark) Æ (1 mark) Trace table for input value 75 X A B OUTPUT 75 9 3 3 9 1 1 1 1 1 Å (1 mark) Æ (1 mark) [4]

For each example: 1 mark for correct structure, 1 mark for appropriate content, 1 mark for the reason. There are many correct answers these are only examples IF X > 0 AND X <= 10 THEN PRINT 'In Range' ELSE PRINT 'Out of Range' ENDIF – e.g. checking a condition that may be complex//uses relational operators// checking for a range of values// only 2 options CASE X OF 1 : PRINT 'Option 1' 2 : PRINT 'Option 2' 3 : PRINT 'Option 3' OTHERWISE PRINT 'Incorrect choice' ENDCASE – e.g. checking for discrete/large number/more than 2 of values [6]

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