コンテンツへスキップ

Labs · IGCSE 0478 7

Validation Checks

Build the checks for a form field: presence, length, type, range, format and check digit. Every input users typed goes through your checks, with your numbers, and is accepted or rejected.

10 levelsFree bench

In the exam

IGCSE 0478/22 May/June 2024 · Question 4(a) · 6 marks

A program needs to make sure the characters input for a product code meet these rules: the product code is six characters in length; the first two characters must be “PD”; the last four characters must be a number in the range 1000 to 9999 inclusive. Identify three validation checks and state how each check would make sure the product code met one of these rules.

Points that gain marks

  • A length check, to make sure the product code is 6 characters long.
  • A format check, to make sure the first two characters are “PD”.
  • A range check, to make sure the last four characters are a number from 1000 to 9999.

In this lab: Level 'Exam: a product code'.

IGCSE 0478/21 May/June 2025 · Question 2 · 7 marks

(a) Draw one line from each requirement to the most appropriate validation check (date of birth between 01/01/1900 and 01/01/2010; name has been entered; password has exactly 12 characters; student ID of 2 letters followed by a 4-digit number). (b) Identify one verification check and describe how it works.

Points that gain marks

  • (a) Range check; presence check; length check; format check.
  • (b) Visual check: look at the data that has been entered and confirm it matches the original.
  • (b) Double entry check: enter the data twice and only accept identical values.

In this lab: Levels 'Which check?', 'Exactly 12 characters', 'Two letters, four digits' and 'Validation or verification?'.

IGCSE 0478/22 February/March 2026 · Question 2(a)–(b) · 5 marks

(a) Identify the type of validation check: (i) data input follows a set pattern, such as two letters followed by three numbers; (ii) only whole numbers can be input. (b) Explain the reasons why validation checks are necessary when data is input.

Points that gain marks

  • (a)(i) Format check. (ii) Type check.
  • (b) To check that the data meets the criteria, that it is sensible.
  • (b) The checks are automatic, as the data is entered.
  • (b) They reduce errors before the data is stored, so less correction is needed later.

In this lab: Levels 'An age from 11 to 18', 'Exam: a product code' and 'Which check?'.

IGCSE 0478/23 May/June 2025 · Question 4 · 11 marks

(a) An input must be an integer between 10 and 95, inclusive. (i) State the type of validation check. (ii) Suggest abnormal and extreme test data, with a reason for each. (b) All new passwords must contain at least 12 characters. (i) State the type of validation check. (ii) Write the pseudocode to input a new password until it contains at least 12 characters, with an error message.

Points that gain marks

  • (a)(i) Range check. (ii) Abnormal: 150, out of range, so it should be rejected. Extreme: 10 or 95, the smallest or largest value that is accepted.
  • (b)(i) Length check.
  • (b)(ii) REPEAT, INPUT Password, IF LENGTH(Password) < 12 THEN OUTPUT an error message, ENDIF, UNTIL LENGTH(Password) >= 12.

In this lab: Levels 'Exam: test data, 10 to 95' and 'Exam: at least 12 characters'; the Trace Tables level 'IGCSE exam: ask again' writes a loop like (b)(ii).

IGCSE 0478/23 October/November 2025 · Question 7(c) · 4 marks

The algorithm can accept a number between 1 and 255 inclusive as input. Two validation checks that could be applied to DenaryNumber are a presence check and a type check. (i) Identify one other validation check that could be applied to DenaryNumber. (ii) Write the pseudocode to implement the validation check you identified in (c)(i).

Points that gain marks

  • (i) A range check.
  • (ii) A suitable loop with a suitable condition and the input of DenaryNumber, for example: REPEAT INPUT DenaryNumber UNTIL DenaryNumber >= 1 AND DenaryNumber <= 255.

In this lab: Level 'An age from 11 to 18' (a type check and a range check); the Trace Tables level 'IGCSE exam: ask again' writes this kind of loop.

IGCSE 0478/22 February/March 2024 · Question 2(b) · 4 marks

An algorithm has been written to test if an integer that is input is in the range 5 to 10 inclusive. Identify an example of suitable test data for each test data type: abnormal, boundary, extreme, normal.

Points that gain marks

  • Abnormal: for example 31.
  • Boundary: 4 and 5, or 10 and 11.
  • Extreme: 5 or 10.
  • Normal: for example 6.

In this lab: Level 'Exam: test data, 5 to 10'.

IGCSE 0478/22 October/November 2025 · Question 3 and 4(a) · 7 marks

3: A program will only accept values from –99.99 to +99.99 inclusive. Complete the table of test data, type (normal, boundary, abnormal) and purpose: 0 | … | …; … | boundary | …; … | … | to make sure the program rejects data outside acceptable limits. 4(a): State the purpose of a length check.

Points that gain marks

  • 3: 0 is normal data, to make sure the program accepts data that is in range.
  • 3: 100 (or –100) is boundary data, to make sure the program rejects data on the wrong side of the boundary.
  • 3: 300 is abnormal data (it rejects data outside acceptable limits).
  • 4(a): To check that the data entered has the required number of characters.

In this lab: Levels 'Exam: test data, 10 to 95' and 'Exam: test data, 5 to 10' (normal, abnormal, extreme and boundary, classified live), and 'Exactly 12 characters' (a length check).

IGCSE 0478/23 October/November 2025 · Question 7(c) · 4 marks

The algorithm can accept a number from 1 to 255 inclusive as DenaryNumber. A presence check and a type check could be applied. (i) Identify one other validation check that could be applied to DenaryNumber. (ii) Write the pseudocode to implement it.

Points that gain marks

  • (i) A range check.
  • (ii) A suitable loop, a suitable condition and the input of DenaryNumber, for example: REPEAT INPUT DenaryNumber UNTIL DenaryNumber >= 1 AND DenaryNumber <= 255.

In this lab: Add a presence check, a type check and a range check from 1 to 255 on the free bench, and type your own test inputs (0, 1, 255, 256, a word).

IGCSE 0478/21 October/November 2025 · Question 2 · 3 marks

Identify three different types of test data that can be used to test a program.

Points that gain marks

  • Normal; abnormal; extreme; boundary.

In this lab: Levels 'Exam: test data, 10 to 95' and 'Exam: test data, 5 to 10'.

More real experiments

All labs →

ログインまたはアカウント作成

IGCSE, A-Level & AP