Yr 11 - Trace tables

Trace tables
1 / 27
volgende
Slide 1: Tekstslide
ComputingUpper Secondary (Key Stage 4)GCSE

In deze les zitten 27 slides, met interactieve quizzen en tekstslides.

time-iconLesduur is: 50 min

Onderdelen in deze les

Trace tables

Slide 1 - Tekstslide

What is a trace table?
A trace table is a debugging technique used to track the value of variables and outputs, through the flow of a program.

It helps to visualise how the program progresses step by step.

Slide 2 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y

Slide 3 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
First step:
Variables and outputs for table headers

Slide 4 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1

Slide 5 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3

Slide 6 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2

Slide 7 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2

Slide 8 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6

Slide 9 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3

Slide 10 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9

Slide 11 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9
4

Slide 12 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9
4
12

Slide 13 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9
4
12
5

Slide 14 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9
4
12
5
15

Slide 15 - Tekstslide

Pseudocode:
FOR x = 1 to 5
   y = x*3
   x+1
OUTPUT y
x
y
output
1
3
2
6
3
9
4
12
5
15
15

Slide 16 - Tekstslide

When would you add a value to a trace table?
A
When the software produces an output.
B
When a variable is created.
C
When a variable changes.
D
All are correct.

Slide 17 - Quizvraag

Challenge 1
a = 4
y = 0
FOR x = 1 to a
    y = y +(x * a)
    x + 1
OUTPUT y
Challenge 2
a = 3, b = 2, y = 0
FOR x = 1 to 5
    IF x MOD 2 = 0 THEN
          y = (a * y) + (b * x)
    ELSE
         y = y + (b * x)
    x + 1
OUTPUT y

Slide 18 - Tekstslide

Challenge 1
a = 4
y = 0
FOR x = 1 to a
    y = y +(x * a)
    x + 1
OUTPUT y
Score out of 11
a
x
y
output
4
0
1
4
2
12
3
24
4
40
40

Slide 19 - Tekstslide

Add up your score out of 11 and enter them below:

Slide 20 - Open vraag

Challenge 2
a = 3, b = 2, y = 0
FOR x = 1 to 5
    IF x MOD 2 = 0 THEN
          y = (a * y) + (b * x)
    ELSE
         y = y + (b * x)
x + 1
OUTPUT y
Score out of 14
a
b
x
y
Out
3
2
0
1
2
2
10
3
16
4
56
5
66
66

Slide 21 - Tekstslide

Add up your score out of 14 and enter them below:

Slide 22 - Open vraag

Challenge 3:
a = 5, b = 0, c = 1
WHILE c <= a DO
   b = b + c
   c + 1
END WHILE

OUPUT b

a
b
c
output

Slide 23 - Tekstslide

What is the purpose of a trace table in programming?
A
To write code
B
To track the values of variables
C
to execute the program
D
To design algorthms

Slide 24 - Quizvraag

In a trace table, each row typically represents:
A
A variable
B
A function
C
A step in the program's execution
D
A loop in the program's flow

Slide 25 - Quizvraag

Trace tables are particularly useful for:
A
Debugging programs
B
Writing comments
C
Testing hardware
D
Designing user interfaces

Slide 26 - Quizvraag

How are trace tables helpful in debugging?
A
They write code automatically
B
They highlight syntax errors
C
They track the values of variables during program execution
D
They execute the program

Slide 27 - Quizvraag