Sith 2006

This is an algorithm trace task. No implementation is required.

Read the following algorithm, which operates on numbers held in an array Sift, where the size of the array is 10. All of the variables used in the algorithm are integers.

In the algorithm, DIV is an operator that divides one integer by a second integer and truncates the result to its integer part. This means that

  • 15 DIV 4 is 3
  • 19 DIV 2 is 9

Set up a table with headings and initial values as shown below.

You are required to build a table that will show all the changes to variables and the cells of the array as the algorithm is traced from start to finish.

You should only show a value in the Variables columns when the algorithm writes a value to that cell.

You should, however, complete all of the cells of the array Sift each time any cell in the array Sift is written to.

Develop the table by working from left to right and top to bottom.

This means that when you need to write a new value in a cell that is to the left of the last cell you wrote in, you must move to the next row.

sith2006.jpg - 12/2015

 

This task was worth 16 Marks.  It was a software development task and an implementation task that orginally appeared in OCR 2507 Task 2 Jun 2006.  All rights and copyright to OCR.  Please refer to the OCR Copyright Statement for further information.

Comments 0

Write a Reply or Comment

We will not publish your email.*


*