2210/21/M/J/21 question 4: worked solution (May/June 2021, paper 21)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 7.9 Writing and amending algorithms Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 8 of 8. Q87 2210/21/M/J/21 original Q4 Structured · 9 marks Worked solution (a) Describe the steps in order. Write three of these: The marks input are stored in the array Score[] [1] Each mark is checked against boundaries (70, 60, 50, 40, 30) and a matching grade is stored in the array Grade[] at the same index as the mark [1] This is repeated until 30 marks have been input [1] (b) Use a loop to go through each element and output both arrays with a message. FOR Count ← 0 TO 29 OUTPUT "Student: ", Count, " Mark: ", Score[Count], " Grade: ", Grade[Count] NEXT Count Correct loop (including a counter if it is not a FOR loop) [1] Score[] and Grade[] both output correctly [1] Suitable messages or text in the output [1] A WHILE or REPEAT loop with its own counter also scores. (c) Write three of these: Add an input so the teacher can enter the class size [1] Store it in a variable and use it as the end condition of the loop (UNTIL Count = ClassSize) [1] Make sure the arrays are big enough for the largest class [1] KEY IDEA Use a variable for the class size and loop to it instead of a fixed number like 30. TOTAL 9 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.