Menu

Inputs, Processes and Outputs

Processes

A process is work that the program does with its data. Inputs arrive and outputs are produced, but in between the data has to be changed, checked or kept track of — that work is the process. Without processes, the data would just sit there.

The kinds of work a process can do

  • Calculations — arithmetic on the data, such as multiplying a price by a quantity or dividing a distance by a time.
  • Comparisons and decisions — testing a value and choosing what happens next, such as checking whether a player's score has beaten the level target and then choosing which screen to show.
  • Counting and totalling — keeping track of how many times something has happened, or adding values together.
  • Storing values — keeping data in a variable while the algorithm runs so that later steps can use it.

One process often does two of these at once. Adding a new value to a running total is a calculation, and the answer has to be stored so the next value can be added to it. The running total grows as the algorithm runs, so it needs a variable to hold it; working it out once and throwing it away would lose everything added before.

Worked example

A Year 10 tutor group runs a bake sale to raise money for an animal shelter, and every cake sells for £2. Each time a cake is sold, £2 is added to a running total — a calculation whose answer has to be stored in a variable. A second variable counts how many cakes have been sold, so its value goes up by one with every sale. After each sale the running total is compared with the group's £120 target, and the decision is whether to put out the “target reached” sign. At any moment, subtracting the running total from £120 shows how much money is still needed — a calculation that uses the stored total and the target.

Practise this

OCR GCSE Computer Science · Inputs, Processes and Outputs