ข้ามไปยังเนื้อหา

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.

7 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' 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 'An age from 11 to 18' and 'Exam: at least 12 characters'; the Trace Tables level 'IGCSE exam: ask again' writes a loop like (b)(ii).

More real experiments

เข้าสู่ระบบหรือสร้างบัญชี

IGCSE, A-Level & AP