0% found this document useful (0 votes)
50 views9 pages

Gr8 7.trace Table

Uploaded by

iitguru2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views9 pages

Gr8 7.trace Table

Uploaded by

iitguru2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Trace Table

Trace Table Definition


Trace tables are used to follow algorithms and
make sure they perform the required task
correctly. Test data is usually used in
conjunction with a trace table to ensure the
correctness of the algorithm. Manually tracing
an algorithm with test data in this way is known
as a dry run.
Purpose of Trace Table:
• Trace tables can be used with flowcharts or pseudocode
or even real code if necessary
• Trace tables can also be used to discover the purpose of
an algorithm by showing output data and intermediary
steps
• Trace tables record the state of the algorithm at each
step or iteration. The state includes all variables that
impact the algorithms output as well as the output itself
• A trace table is composed of columns where each variable
and the output is a column
• Whenever a value changes or an output is produced the
relevant column and row is updated to reflect the change
Example 1
Complete the trace
table for the given
data. N=2

N OUTPUT
Example 2
Example 2
START

A0
B0
C  100

Input X

Example 3 X > B?
Yes
BX
A B
Class Activity-Worksheet 9 –Q1
Complete the trace table for the input data.
C X OUTPU
4 , 3, 2, 1, 0, -2 T No
X< Yes
C? CX

No
A  A +1

No
Yes A < 6?

Output B, C

END
START

A0
B0
C  100

Input X

Example 3 X > B?
Yes
BX
A B
Class Activity-Worksheet 9 –Q1
Complete the trace table for the input data.
C X OUTPU
4 , 3, 2, 1, 0, -2 T No
Yes
0 0 100
X<
C? CX

1 4 4 No
A  A +1

2 3 3 No
Yes
3 2 2 A < 6?

4 1 1
5 0 0 Output B, C

6 -2 -2 4 -2 END
HW- Trace Table worksheet

You might also like