← Computer Science

Standard Methods, Validation and Test Data

Many programs reuse the same building blocks, such as adding up a total or finding the largest value. This lesson covers those standard algorithm methods, then looks at the difference between validation and verification, the common validation checks, and the categories of test data used to check a program thoroughly.

Slide 1 / 4

Totalling, counting and running totals

Running total: Total <- Total + NumberTotal0+5Total5+8Total13+3Total16each new Number is added to the total as it arrives
  • Totalling adds a set of values together, usually by starting a total variable at 0 and adding each new value to it, for example Total <- Total + Number.
  • Counting keeps track of how many items or events have occurred, usually with a counter that starts at 0 and increases by 1 each time, for example Count <- Count + 1.
  • A running total is a total that is updated as each new value arrives, rather than only being worked out once at the end.
  • A flag is a variable, often set to True or False, used to record that a particular condition has happened, such as a matching item being found.

Check you've got it

0/4

1. A program should accept an exam mark from 0 to 100. Which value is an example of BOUNDARY test data?

2. Which check makes sure a required field, such as a surname, has not been left blank?

3. Trace this pseudocode, which finds the largest value. Max <- 4 FOR Each IN 9, 2, 7 IF Each > Max THEN Max <- Each ENDIF NEXT Each OUTPUT Max What is output?

4. What is the difference between validation and verification?

Practise real exam questions on this

Type your answer, see your mark against the mark scheme in seconds. Free, 5 a day.

Start practising →

Teaching this topic?

Mark your whole class's answers and see who's stuck, for £19 a month.

See the class plan →

Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark.