A program validates a numeric field as follows: values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following covers the MOST boundary values?

  1. 9,10,11,22

  2. 9,10,21,22

  3. 10,11,21,22

  4. 10,11,20,21


Correct Option: B

AI Explanation

To answer this question, we need to consider the given validation criteria and determine which option covers the most boundary values.

The validation criteria are as follows:

  • Values less than 10 are rejected.
  • Values between 10 and 21 (inclusive) are accepted.
  • Values greater than or equal to 22 are rejected.

Let's evaluate each option to see which one covers the most boundary values:

Option A) 9, 10, 11, 22

  • 9 is less than 10 and should be rejected.
  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 2 boundary values: 10 and 22.

Option B) 9, 10, 21, 22

  • 9 is less than 10 and should be rejected.
  • 10 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 2 boundary values: 10 and 21.

Option C) 10, 11, 21, 22

  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 3 boundary values: 10, 11, and 21.

Option D) 10, 11, 20, 21

  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 20 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.

This option covers 4 boundary values: 10, 11, 20, and 21.

Therefore, the option that covers the most boundary values is Option D) 10, 11, 20, 21.

Find more quizzes: