Quelpr

CAPE Computer Science Unit 2 · 2006 · Paper 2 · Question 4(a)

A list L1 contains 100 elements, and a list L2 of size 150 has 20 elements stored in its first 20 locations (indices 0 to 19). Write an algorithm to move all elements of L1 to L2 starting at the first location of L2, placing the existing 20 elements immediately after the elements from L1, and then set all elements in L1 to zero.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 4(b)Given that L1 contains 100 integer elements, write an algorithm to reverse the elements of L1.[7 marks]
  2. 4(c)(i)Describe 2nd generation programming languages.[3 marks]
  3. 4(c)(ii)Describe 3rd generation programming languages.[3 marks]
  4. 4(d)What is meant by structured programming?[4 marks]
  5. 4(e)Explain how a program written in a high-level language is executed on a computer.[4 marks]

More practice: the rest of this paper · more Abstract Data Types (ADTs) questions · all CAPE Computer Science Unit 2 past papers