Computer Science 9608 (Notes)

Chapter: 2.1 Algorithm design and problemsolving Topic: 2.1.3 Corrective maintenance 2.1.4 Adaptive maintenance Trace table - a technique used to test algorithms to make sure that no logical errors occur. Hand tracing or 'dry running' allows you to use a trace table to see what code will do before you have to run it locate where errors in your code are Taking a program like the one below we need to keep track (trace) all the variables and outputs.

Dim y as integer = 3 For x = 1 to 4 y = y + x Loop Console.writeline(y)

To do this we create a trace table: x

y

1

3

2

4

3

6

4

9

4

13

output

13

The exam will normally ask you to create a trace table of some sort so you need to be very confident with them. The exam will usually give you the headings but just in case; there are several steps in making a trace table,

Page 1 of 4

Computer Science 9608 (Notes)

Chapter: 2.1 Algorithm design and problemsolving Topic: 2.1.3 Corrective maintenance 2.1.4 Adaptive maintenance The first one is to note the table headings, this involves the following: 1. VARIABLES: note all the variables in the piece of code you are looking at (this includes arrays). Note each variable as a heading 2. OUTPUTS: note if there is an output and put this as a heading 3. INPUTS: if there are inputs specified, put an inputs column and be prepared to fill it in. It is very easy to jump right in when filling in trace tables, but you must be careful. The exam will try and trick you, so trying to predict what a trace table will do isn’t a good idea. In fact, the best idea is to switch your brain off and tackle the problem line by line, exactly as a computer would. Take a look at the following example:

Example: Simple trace table Dim num() as integer = {10,8,3,5,6,1,2} Dim sum as integer = 0 Dim avg as decimal For x = 0 to 5 sum = sum + num(x) Loop avg = sum / (x + 1) Console.writeline("average =" & avg) 1. note all the variables: num array / sum / avg / x 2. note if there is an output: yes 3. if there are inputs specified: no

Page 2 of 4

Computer Science 9608 (Notes)

Chapter: 2.1 Algorithm design and problemsolving Topic: 2.1.3 Corrective maintenance 2.1.4 Adaptive maintenance

So we should construct the following table: num 0

1

2

3

4

5

6

sum avg

10

8

3

5

6

1

2

0

x

output

0 Now looking at the names of the variables you might be tempted to add all the values in the array together to find the sum, and then find the average number from this calculation “35/7 =5”. However, you'd be wrong, create a trace table and see if you can find the correct answer: Answer : num 0

1 2 3 4 5 6 sum avg

10 8

3 5

6

1

2

x

output

0 10

0

18

1

21

2

26

3

32

4

33

5.5

5

average =5.5

Page 3 of 4

Computer Science 9608 (Notes)

Chapter: 2.1 Algorithm design and problemsolving Topic: 2.1.3 Corrective maintenance 2.1.4 Adaptive maintenance

So what went wrong? If you look at the trace table you can see that we never added the number 2 from the num array to the sum, it stopped at element 5. To fix this we would adjust the following line: “For x = 0 to 6”

Complete the trace table for the following code: 32T

32T

9T

9T43

9T43

9T37

37T

37T

37T

37T

37T

37T

37T

37T

37T

37T

9T37

Dim nums( )= {6,2,8,1,9,2} Dim n as Integer = 0 32T

32T

32T

32T

32T

32T

43T

3T4

37T4

32T7

37T4

32T7

For i = 0 to 5 If nums(i)> n n = nums(i) endif loop 32T

32T

9T

43T

9T

9T

9T43

43T

43T

9T

9T

9T

32T

32T

Answer: i

n

What function does the above code perform?

nums

Answer:

0 0

0

1

2

3

4

5

6

2

8

1

9

2

It finds the highest value in an array of values.

6

1 2

8

3 4

9

5

Page 4 of 4

2.1.3 & 2.1.4 Corrective and Adaptive maintenance.pdf

2.1.3 & 2.1.4 Corrective and Adaptive maintenance.pdf. 2.1.3 & 2.1.4 Corrective and Adaptive maintenance.pdf. Open. Extract. Open with. Sign In. Main menu.

206KB Sizes 2 Downloads 107 Views

Recommend Documents

2.1.3 & 2.1.4 Corrective and Adaptive maintenance.pdf
Computer Science 9608 (Notes) ... Taking a program like the one below we need to keep track (trace) all the variables and ... In fact, the best idea is to switch.

213.pdf
Page 1 of 2. Policy 213. Page 1 of 2. PEQUOT LAKES PUBLIC SCHOOLS. INDEPENDENT SCHOOL DISTRICT #186. I. PURPOSE. The purpose of this policy is to provide for the structure and the operation of committees. and task forces of the school board. II. GENE

Schapiro Exhibit 213
Page 1. Schapiro Exhibit 213. Page 2. Page 3. Schapiro Exhibit 214. Page 4. Page 5. Schapiro Exhibit 215. Page 6.

Q13MAY 214.pdf
What is web photo gallery? How to create a web photo gallery? 5. Discuss the steps involved in creating basic animation in Flash. 6. Explain how to integrate ...

Corrective Dependency Parsing - Research at Google
dates based on parses generated by an automatic parser. We chose to ..... this task, we experimented with the effect of each feature class being added to the .... Corrective modeling is an approach to repair the output from a system where more.

214-453-1-SM.pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. 214-453-1-SM.pdf. 214-453-1-SM.pdf. Open. Extract. Open with.Missing:

214. Bege barita ni suruan.pdf
T 5 . 5 0 | 1 ̇ . 1 ̇ . | 7 . 5 0 |||. B 5̣ . 5̣ 0 | 1 . 1 . | 5̣ . 5̣ 0 |||. A men A men A men. Retyped by. Advendes Pasaribu. 18 Nov 2017. ADNOC Offshore, ND79. SARB North ISland. Abu Dhabi. Page 2 of 2. 214. Bege barita ni suruan.pdf. 214. B

DM 213 s.2016.pdf
Sign in. Page. 1. /. 1. Loading… Page 1 of 1. Page 1 of 1. DM 213 s.2016.pdf. DM 213 s.2016.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying DM 213 s.2016.pdf.

BISCAST-PM-03_Control of Non-Conformity and Corrective ...
ISO 9001:2008 : International Standard Quality Management System ... Records of accepted non-conforming product or ... surveys and analyzed data. ... BISCAST-PM-03_Control of Non-Conformity and Corrective Preventive Action.pdf.

Fy 1 214 I.pdf
Page 1 of 1. Page 1 of 1. Fy 1 214 I.pdf. Fy 1 214 I.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying Fy 1 214 I.pdf. Page 1 of 1.

214-E Agenda format.pdf
Page 2 of 4. Page 2 of 4. Page 3 of 4. 214-E Agenda format.pdf. 214-E Agenda format.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying 214-E Agenda format.pdf. Page 1 of 4.

Cheap Sticker For Sigelei Fuchai 213 Plus Skin Cover 213 Plus ...
Cheap Sticker For Sigelei Fuchai 213 Plus Skin Cover ... Protective Cover Free Shipping & Wholesale Price.pdf. Cheap Sticker For Sigelei Fuchai 213 Plus Skin Cover 2 ... s Protective Cover Free Shipping & Wholesale Price.pdf. Open. Extract. Open with

lilik sudiajeng 213-219.pdf
Body Map for evaluating body part. discomfort, sedangkan kelelahan. subjektif diukur dengan menggunakan. kuesioner 30 item pertanyaan. Analisis.

Lisa Labrado [email protected] Direct: 646-214 ...
Jun 10, 2014 - touching and humorous look at love and love songs, on June 24-25, 7:00pm and 9:00pm ... the Adrienne Arsht Center for the Performing Arts of Miami-Dade County, is the ... ADF will host one-hour Saturday Children's Matinees on June 21 (

Mobile Strike Hacker 214
... feed, Code Generator Mobile Strike Hack DownloadCode Generator Buy .... Best Mobile Strike Cheats For Android Live Free Game Generator Codes on ...

Lisa Labrado [email protected] Direct: 646-214 ...
Jun 10, 2014 - ADF will host one-hour Saturday Children's Matinees on June 21 (Ballet .... the best in modern dance for 81 years. americandancefestival.org.

TM 9-213 Painting Instructions.pdf
(Superseded) Lettering and stencil alphabet. 2 AGO 7388A. Page 3 of 141. TM 9-213 Painting Instructions.pdf. TM 9-213 Painting Instructions.pdf. Open. Extract.

213 - PETIT ROEULX - 27.09.2015 - 5,2 kms - GENERAL.pdf ...
2 43 D'AURILIO Simeon Joggers Beersel EH 1 16,94 3:33 00:18:36 873. 3 212 D'AURILIO Marvin Joggers Beersel EH 2 16,92 3:33 00:18:37 871. 4 1007 HOUDART Pierre ACLO/JC Estinnes SE 1 16,76 3:35 00:18:48 864. 5 132 WOZNY Eric RRB/CRAC V2 1 16,52 3:38 00

пос 213.PDF
AO >: a) o6ecneqrrr 6ecuepe6ofiuyro pa6ory rereSonnux cetefi, oco6euHo B roMeuleHuqx. uz6up at e tbHo f o c oB era u yqacrKoB stx uz6uparc JIsrIbIx 6rop o. 2. Hacroqqee nocraHoBJreHrze orrrpaBzTb BbrrlreyrloMtHyrblM opraHaM Ir yqpexleHl4tM. Anfl Ha3H

artigos-prontos-08-03-214-224.pdf
conseguiu descrever muitos sinais e sintomas de enfermidades. O seu objetivo era que essas informações. Page 3 of 11. artigos-prontos-08-03-214-224.pdf.