QuestionQ93

Chapter 4: Test Analysis and Design

Consider a program that calculates the factorial of a number (n). The specifications state that:

  • If n < 0, the message "Value out of range" must be issued.
  • If 0 ≤ n ≤ 100, the program calculates the factorial and returns the number.
  • If 100 ≤ n ≤ 200, the message "Value out of range" must be issued.

Which of the following statements about the equivalence partitions is correct?

  • A There are 3 partitions - one for negative numbers, one for numbers up to 100 and the last one for numbers up to 200
  • B The requirements are not correct because the partitions are overlapping
  • C The equivalence partitions cannot be determined for this question because the error message for two partitions is exactly same
  • D The equivalence partitions cannot be determined for this question because factorial of numbers close to 200 will be very large
Explanation

The value n = 100 belongs to both the range that requires factorial calculation and the range that requires a "Value out of range" message. Because the requirements prescribe conflicting behavior for the same input, the partitions overlap and the specification is inconsistent. An equivalence partition is a subset of a value domain whose values are expected to receive the same treatment according to the specification.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!