Quelpr

CAPE Computer Science Unit 1 · 2015 · Paper 2 · Question 3(d)

Write an algorithm using iteration to calculate the sum of all multiples of 8 and all multiples of 11 between m (inclusive) and n (exclusive), where m and n are positive integers input by the user and n > m.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 3(a)Explain what takes place during the 'implementation and review' stage of problem-solving.[4 marks]
  2. 3(b)(i)Identify which of the two algorithms illustrates unbounded iteration.[1 mark]
  3. 3(b)(ii)Identify which of the two algorithms illustrates bounded iteration.[1 mark]
  4. 3(b)(iii)Explain how the loop in Algorithm 1 is expected to terminate.[2 marks]
  5. 3(b)(iv)Explain how the loop in Algorithm 2 is expected to terminate.[2 marks]
  6. 3(c)Identify and correct FOUR errors in the algorithm by referencing their specific line numbers.[8 marks]

More practice: the rest of this paper · more Algorithm Verification and Development questions · all CAPE Computer Science Unit 1 past papers