Software Development and Project Management

An input field accepts only integers; values from 1 to 100 inclusive are accepted and all others cause an error. When the input is divided by equivalence partitioning, how many equivalence classes are there in total (valid and invalid classes combined)?

  1. A1
  2. B2
  3. C3
Show answer and explanation

Answer: C. 3

Equivalence partitioning divides the inputs into groups (equivalence classes) that the program should handle in the same way, and tests one representative value from each class. For this field there is one valid class (1 to 100) and two invalid classes (0 or less, and 101 or more), giving 3 in total. Choosing, for example, 50, −5 and 150 as representatives checks every class with three tests. The invalid inputs are split into a low side and a high side because the program handles them with separate checks (the lower-limit check and the upper-limit check).

  • A. This counts only the valid class. Invalid inputs that should cause an error must also be tested.
  • B. This merges the invalid classes into one. Values of 0 or less and 101 or more are rejected by separate checks, so they form separate classes.
  • C. Correct. There is one valid class (1 to 100) and two invalid classes (0 or less, 101 or more).
Practice this topic Back to topic

Related calculators

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

More Software Development and Project Management questions

  1. A program sets the admission fee by age (an integer of 0 or more): ages 0 to 17 pay the child fee, 18 to 64 the adult fee, and 65 or older the senior fee. Which set of test values is most appropriate for boundary value analysis to check the boundaries where the fee category changes?
  2. The specification says 'issue a warning if the temperature is 85 °C or higher', but the firmware mistakenly contains 'if (t > 85)'. The temperature t is an integer. Which of the following test values can detect this error?
  3. The values of temp and err can be chosen independently of each other. For the code 'if (temp > 80) { fan = HIGH; } else { fan = LOW; } if (err) { log(); }', what is the minimum number of test cases needed to achieve statement coverage (executing every statement at least once)?
  4. The truth values of a, b and c can be chosen independently of each other. For the code 'if (a) { S1; } if (b) { S2; } if (c) { S3; }', what is the minimum number of test cases needed to achieve branch coverage (executing both the true and false outcomes of every decision at least once)?
  5. For the decision 'A and B' (A and B are conditions whose truth values can be set independently), two test cases were run: (A = true, B = false) and (A = false, B = true). Which statement about coverage criteria is correct?