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)?
- A1
- B2
- 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).
Continue: 9 more Software Development and Project Management questions