6.6 Interpret, correct and complete algorithms Flashcards
Give some different ways a programmer could use to find mistakes in their programs
Use a trace table
Alternatively IDEs
What are trace tables
A programmer goes through the code, line by line, writing down the values of variables
What are IDEs?
Integrated Development Environments which have the ability to set breakpoints, step through code and watch variables. This is similar to trace tables and allows the computer to do the processing.
Why can trace tables be useful?
Determining the purpose of an algorithm
Finding the output of a algorithm
Finding errors in an algorithm
What do you have to keep in mind when drawing a trace table?
For every variable used, draw a column in which the order they appear
You do not need to fill in a value for a variable which does not change in a particular row
Explain what are syntax errors?
Doesn’t follow the rules of the language
Explain what are logical errors?
The logic of the program is incorrect
Give an example of a syntax error
print(“hello)
There is no final “ for the end of the string
Give an example of a logical error
average = ((n1+n2)/3)
the average would need to be divided by 2 instead of 3