COMPUTER SCIENCE - TESTING AND DEBUGGING

Validation Worksheet

  • 10 questions
  • Understand the need for validation checks to be made on input data and the different types of validation check
  • Difficulty: Medium
  • Board: CAIE
  • Attempt online on the examination portal
Start the 10-question quiz Free, no sign-up needed. Your score shows instantly.

Here are the first 3 questions. Click “View all questions” to see the complete assessment.

Q1.

An online shop validates an order quantity before calculating the total cost. Why is validation needed at this stage?

  1. A) To compare the entered quantity with the customer's original written order
  2. B) To confirm that the customer has entered the quantity they intended
  3. C) To ensure that the customer has enough money to pay
  4. D) To prevent unacceptable input from being used in the calculation

Q2.

A freezer-monitoring system accepts temperatures from −25 to −15 inclusive. Why is a range check more suitable than a type check alone?

  1. A) A range check makes sure that every temperature contains the same number of digits.
  2. B) A type check rejects every negative number, including acceptable temperatures.
  3. C) A type check could accept −10 as numeric, although it is outside the permitted limits.
  4. D) A range check confirms that the sensor measured the temperature accurately.

Q3.

A delivery form requires the number of parcels to be an integer. An input of 2.5 is rejected even though it is numeric. Which explanation identifies the validation check involved?

  1. A) A presence check rejects the input because part of the number is missing.
  2. B) A type check rejects the input because a decimal value is not an integer.
  3. C) A length check rejects the input because decimal numbers are always too long.
  4. D) A range check rejects the input because all decimal numbers are negative.

Q4.

A registration form uses only a presence check on a required telephone-number field. A user enters the word 'unknown'. Why might this input pass the check?

  1. A) The check accepts text only when the correct telephone number is unavailable.
  2. B) The check converts any text entered into a valid telephone number.
  3. C) The check establishes only that an entry has been supplied, not that it is a usable telephone number.
  4. D) The check compares the entry with a directory of existing telephone numbers.

Q5.

A product code must contain two uppercase letters followed by four digits. The input A12345 passes a six-character length check but is still unacceptable. Which additional check would directly identify the problem?

  1. A) Another length check to confirm that the code contains six characters
  2. B) A format check to test the character types and their positions
  3. C) A range check to confirm that the code represents a positive number
  4. D) A presence check to confirm that the code is not empty

Q6.

A comment field allows a maximum of 200 characters. Why is a maximum-length check appropriate for this field?

  1. A) It rejects comments containing more characters than the field permits.
  2. B) It checks that each statement in the comment is factually correct.
  3. C) It checks that the comment contains exactly 200 words.
  4. D) It rejects comments whose words are not in a dictionary.

Q7.

The final digit of a library-book identifier is a check digit calculated from the other digits. When the identifier is entered, the system recalculates the check digit and compares it with the one entered. What is the main purpose of this process?

  1. A) To automatically replace any incorrectly entered digit with the correct digit
  2. B) To prove that the book is currently available to borrow
  3. C) To detect certain errors made when entering the identifier
  4. D) To ensure that every book identifier has a different number of digits

Q8.

A security code is stored as text and must contain exactly four digits. Leading zeros are allowed. A developer suggests converting the code to an integer and checking that its value is between 1000 and 9999. Why is this unsuitable?

  1. A) It would prove that any accepted code belongs to the person entering it.
  2. B) It would reject an allowed code such as 5831 because its value is above 1000.
  3. C) It would reject an allowed code such as 0042 because its converted value is below 1000.
  4. D) It would accept every five-digit code because all five-digit codes are greater than 1000.

Q9.

The table shows results from testing a single validation rule on a reference field. Which rule is consistent with all four results?

Diagram for question 9: The table shows results from testing a single validation rule on a reference field. Which rule is consistent…
  1. A) The entry must begin with a letter.
  2. B) The entry must not be empty.
  3. C) The entry must contain exactly five characters.
  4. D) The entry must contain digits only.

Q10.

The diagram shows validation stages for the duration of an equipment loan. An entry is rejected as soon as it fails a stage. A user enters 3.5. At which stage is this entry rejected, and why?

Diagram for question 10: The diagram shows validation stages for the duration of an equipment loan. An entry is rejected as soon as…
  1. A) Stage C, because a range check always rejects decimal values
  2. B) Stage B, because 3.5 is not a whole number
  3. C) Stage C, because 3.5 is outside the permitted interval
  4. D) Stage A, because a decimal value counts as an empty entry

What this assessment covers

Concepts Tested

  • Testing and Debugging
  • Understand the need for validation checks to be made on input data and the different types of validation check

Question Mix

  • Medium questions included

Skills you build

  • Understand