Computer Science GCES EDEXCEL
-
Decomposition And Abstraction Edexcel2 主题
-
Algorithms Edexcel11 主题
-
Follow And Write Algorithms Edexcel
-
Introduction To Programming Concepts Edexcel
-
Basic Programming Concepts Edexcel
-
Variables Constants And Assignments Edexcel
-
Data Structures And Arrays Edexcel
-
Arithmetic Relational And Logical Operations Edexcel
-
Determine Outputs Of An Algorithm Edexcel
-
Types Of Errors Edexcel
-
Standard Sorting Algorithms Edexcel
-
Standard Searching Algorithms Edexcel
-
Algorithm Efficiency Edexcel
-
Follow And Write Algorithms Edexcel
-
Truth Tables Edexcel3 主题
-
Binary Edexcel6 主题
-
Data Representation Edexcel4 主题
-
Data Storage And Compression Edexcel2 主题
-
Hardware Edexcel5 主题
-
Software Edexcel3 主题
-
Programming Languages Edexcel2 主题
-
Networks Edexcel7 主题
-
Network Security Edexcel2 主题
-
Environmental Issues Edexcel1 主题
-
Ethical And Legal Issues Edexcel3 主题
-
Cybersecurity Edexcel2 主题
-
Develop Code Edexcel6 主题
-
Constructs Edexcel4 主题
-
Data Types And Data Structures Edexcel5 主题
-
Operators Edexcel1 主题
-
Subprograms Edexcel2 主题
Determine Outputs Of An Algorithm Edexcel
Exam code:1CP2
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

|
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
|
01 |
|
|
02 |
|
|
03 |
|
|
04 |
|
|
05 |
|
|
06 |
|
Complete the following trace table for the given algorithm, the first two lines have been filled in for you
|
Line number |
X |
Y |
|
|---|---|---|---|
|
01 |
5 |
|
|
|
02 |
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Answer
|
Line number |
X |
Y |
|
|---|---|---|---|
|
01 |
5 |
|
|
|
02 |
|
3 |
|
|
04 |
|
9 |
|
|
05 |
4 |
|
|
|
04 |
|
15 |
|
|
05 |
3 |
|
|
|
04 |
|
21 |
|
|
05 |
2 |
|
|
|
04 |
|
27 |
|
|
05 |
Responses