Trace tables are tables that consist of columns. Each column can represent a variable, a condition, or an output. Not every variable, condition, or output in an algorithm needs a column in a trace table.

Purpose of trace table:

There are two main purposes of trace table.

  • First one to check what the computer will react when we run computer code.
  • Second, To check logic of an algorithm that no logical errors occur when algorithm is being processed.

Trace table consists of multi-column, multi-row table; with each column showing names of data and each row showing values of the data at each step.

In this above example, the Computer program that has a,b,c variables and their respective values assigned to them. To check its working we have designed Trace table if a = 1 then its value is written in a particular column and other columns remain empty or represented by (–) symbol. if b=6 then only a or b value is written and other columns remain empty

At the end, all x,y,z values are written in the columns

Using invalid data for testing:

Testing an algorithm using invalid data ensures that the algorithm can gracefully handle unexpected data inputs. If an algorithm requires your age in number of days but you give the date of birth as input then the algorithm may not work properly.

The purpose of testing using invalid data is to detect such situations.In this case error messages are shown as output. Moreover, this kind of testing will helps you to improve the quality of solution.