Trace Tables for Algorithm Testing

 
Trace tables
 
https://www.cleverrevision.com
 
Starter
 
There are some in errors
in the pseudocode.
 
Re-write the corrected
version.
 
https://www.cleverrevision.com
 
Trace tables
 
A trace table is a technique used to test algorithms to understand or
predict what an algorithm is doing step by step and to identify potential
logic errors.
 
A truth table can be used to find the values of variables or conditions at
each step or to 
determine the output for a known set of data to check it
carries out the task correctly
 
 
https://www.cleverrevision.com
Using trace tables
 
Example of the use of trace table to
check the values of variables as they
change.
 
1.
NUM 
 4
2.
OUTPUT 
NUM
3.
FOR X 
 1 to 3
4.
        NUM 
 
NUM
 + 5
5.
        OUTPUT 
NUM
6.
NEXT
7.
OUTPUT “Finished”
https://www.cleverrevision.com
Complete the trace table for the flowchart below for an input X = 85
https://www.cleverrevision.com
C
o
m
p
l
e
t
e
 
t
h
e
 
t
r
a
c
e
 
t
a
b
l
e
 
f
o
r
 
t
h
e
 
f
l
o
w
c
h
a
r
t
 
b
e
l
o
w
 
f
o
r
 
a
n
 
i
n
p
u
t
 
X
 
=
 
8
5
 
-
 
S
o
l
u
t
i
o
n
https://www.cleverrevision.com
Complete the trace table for the flowchart below for an
input X = 3190 and input X = -40
https://www.cleverrevision.com
Complete the trace table for the flowchart below for an
input X = 3190 and input X = -40 - 
Solution
https://www.cleverrevision.com
 
Complete the tasks in your work
area
 
https://www.cleverrevision.com
Slide Note
Embed
Share

Trace tables are a valuable technique used to test algorithms step by step and identify logic errors. They involve using truth tables to track variable values or conditions. This content provides insights into trace tables, correcting errors in pseudocode, using examples for variable tracking, and completing trace tables for flowcharts.

  • Trace Tables
  • Algorithm Testing
  • Variable Tracking
  • Logic Errors
  • Pseudocode

Uploaded on Sep 30, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Trace tables https://www.cleverrevision.com

  2. Starter There are some in errors in the pseudocode. Re-write the corrected version. https://www.cleverrevision.com

  3. Trace tables A trace table is a technique used to test algorithms to understand or predict what an algorithm is doing step by step and to identify potential logic errors. A truth table can be used to find the values of variables or conditions at each step or to determine the output for a known set of data to check it carries out the task correctly https://www.cleverrevision.com

  4. Using trace tables Example of the use of trace table to check the values of variables as they change. LINE NUM X OUTPUT 1 4 2 4 NUM 4 1. 3 1 2. OUTPUT NUM FOR X 1 to 3 NUM NUM + 5 4 9 3. 5 9 4. 3 2 5. OUTPUT NUM 4 14 6. NEXT 5 14 7. OUTPUT Finished 3 3 4 19 5 19 6 7 Finished https://www.cleverrevision.com

  5. Complete the trace table for the flowchart below for an input X = 85 X N T X < 1 OUTPUT https://www.cleverrevision.com

  6. Complete the trace table for the flowchart below for an input X = 85 Complete the trace table for the flowchart below for an input X = 85 - - Solution Solution X N T X < 1 OUTPUT 85 1 85 8.5 false 2 0.85 85, 2 https://www.cleverrevision.com

  7. Complete the trace table for the flowchart below for an input X = 3190 and input X = -40 X N T X < 1 OUTPUT https://www.cleverrevision.com

  8. Complete the trace table for the flowchart below for an input X = 3190 and input X = -40 - Solution X N T X < 1 OUTPUT 3190 1 3190 false 319 2 false 31.9 3 false 3.19 4 false 0.319 true 3190, 4 -40 1 -40 -4 true -40, 1 https://www.cleverrevision.com

  9. Complete the tasks in your work area https://www.cleverrevision.com

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#