Download presentation
Presentation is loading. Please wait.
1
Unit 8 Tracing Algorithms
12
Unit 8 Tracing Algorithms
13
Most exam questions ask you to TRACE an algorithm.
It is ESSENTIAL that you follow the correct procedure.
19
Exam Technique Ensure each line is recorded down the side in the order they appear Ensure each letter is recorded along the top in the order they appear Instructions such as ‘If’ ‘then go to’ do not need to be recorded If the algorithm says print, add this to the top headings and print the value You do not need to add a separate line for ‘end’
21
P R T I A M Print Line 10 400 Line 20 5 3 Line 30 60 Line 40 460 Line 50 Line 60 12.8 Line 70 12.8
22
P R T A K I M Print Line 10 400 Line 20 5 3 Line 30 400 Line 40 Line 50 Line 60 1 Line 70 20 Line 80 420 Line 60 2 Line 70 21 Line 80 441 Line 60 3 Line 70 22.05 463.05 Line 80 12.9 Line 100 12.9 Line 110
24
A B C D Print Line 10 2 3 Line 20 0 0 Line 30 2 Line 40 3 4 Line 70 Line 90 6 Line 70 6 Line 110 6
25
A B C D Print Line 10 6 8 Line 20 0 0 Line 30 6 Line 40 8 12 Line 70 Line 90 16 Line 70 18 Line 90 24 Line 70 24 Line 110 24 The algorithm defines the LOWEST COMMON MULTIPLE of two integers When A = 200 and B = 300, then C will be 600
27
Model Answer 6ai) Line A B C D K N X Y 10 20 1 30 40 1 50 80 1 100 2 40 2 50 80 2 100 3 40 3 50 80 3
28
Model Answer 6aii) Line A B C D K N X Y 10 20 1 30 40 1 50 80 1 100 2 40 2 50 6 100 3 40 3 50 4 100 4 40 4
29
Model Answer 6aii) Line A B C D K N X Y 80 2 100 5 40 5 50 80 3 Explain where and why this algorithm would fail if A = 0 At Line 90 As N would never = 3
30
Ques 8 X A B Print Line 10 20 8 Line 20 Line 60 10 16 Line 70 Line 60 5 Line 70 32 Line 40 32 Line 60 2 64 Line 70 1 Line 60 128 Line 70 Line 40 160 Line 90 160 The algorithm defines the MULTIPLICATION of A and B A CONTINUOUS LOOP If Line 50 read If A = 1, then go to Line 80 it would create
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.