2210/21/M/J/21 question 5: worked solution (May/June 2021, paper 21)

Show as plain text

Cambridge O Level Computer Science 2210 · 7.7 Trace tables Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 6 of 8. Q49 2210/21/M/J/21 original Q5 Structured · 6 marks Worked solution (a) Run the flowchart for each input. Reject if the value is not from 50 to 100. If it is, Diff1 = 100 - Value and Diff2 = Value - 50. If either difference is less than 1 the output is Extreme, otherwise Normal. The algorithm stops at -1. Value Diff1 Diff2 OUTPUT 50 50 0 Accept: Extreme 75 25 25 Accept: Normal 99 1 49 Accept: Normal 28 Reject: Abnormal 82 18 32 Accept: Normal 150 Reject: Abnormal -1 Value column correct [1] Diff1 column correct [1] Diff2 column correct [1] OUTPUT column correct [1] The data after -1 (672 and 80) is never read. (b) Write two of these: It outputs the type of test data (normal, extreme or abnormal) [1] It does this with a range check , testing if the number is from 50 to 100 inclusive [1] KEY IDEA A range check can sort test data into normal, extreme (on the limits) and abnormal (outside the limits). TOTAL 6 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.