Trace Tables (Cambridge (CIE) IGCSE Computer Science)

Revision Note

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Trace Tables

What is a trace table?

  • A trace table is used to test algorithms and programs for logic errors that appear when an algorithm or program executes

  • Trace tables can be used with flowcharts, pseudocode or program code

  • A trace table can be used to:

    • Discover the purpose of an algorithm by showing output data and intermediary steps

    • Record the state of the algorithm at each step or iteration

  • Each stage of the algorithm is executed step by step.

  • Inputs, outputs, variables and processes can be checked for the correct value when the stage is completed

Trace table walkthrough

  • Below is a flowchart to determine the highest number of ten user-entered numbers

  • The algorithm prompts the user to enter the first number which automatically becomes the highest number entered

  • The user is then prompted to enter nine more numbers.

    • If a new number is higher than an older number then it is replaced

  • Once all ten numbers are entered, the algorithm outputs which number was the highest

  • Example test data to be used is: 4, 3, 7, 1, 8, 3, 6, 9, 12, 10

flowchart question

Trace table: Highest number

Count

Highest

Number

Output

1

 

 

Enter ten numbers

 

4

 

Enter your first number

2

 

3

Enter your next number

3

7

7

 

4

 

1

 

5

8

8

 

6

 

3

 

7

 

6

 

8

9

9

 

9

12

12

 

10

 

10

12 is your highest number

Worked Example

The flowchart represents an algorithm. The algorithm will terminate if –1 is entered.

unnamed-9

Complete the trace table for the input data: 50, 75, 99, 28, 82, 150, –1, 672, 80

[4]

Value

Diff1

Diff2

Output

 

 

 

 

 

 

 

 

Answer

[1] for each correct column

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

 

 

 

Last updated:

You've read 0 of your 5 free revision notes this week

Sign up now. It’s free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Author: James Woodhouse

Expertise: Computer Science

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.