Note AcademyNote Academy

Computer Science · Oct / Nov 2016 · Paper 23 · Question 5

2210

As printed in the paper

The question as text

REPEAT ... UNTIL and WHILE ... DO ... ENDWHILE are two different loop structures you can use when writing pseudocode. Explain, using examples, why you would choose to use each type of loop. Example 1 Reason for choice Example 2 Reason for choice [6]

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

Show the answer and mark scheme

For each example 1 mark for correct structure, 1 mark for appropriate content inside loop and 1 mark for reason. There are many correct answers these are only samples REPEAT ..INPUT Number Total ← Total + Number UNTIL Number = 0 – at least one repeat is required WHILE Number <> -1 DO ..INPUT Number Total ← Total + Number ENDWHILE – the loop may never be executed [6]

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