Q. Consider a program which computes the square root of an input integer between 0 and 5000. Determine the equivalence class test cases. Determine the test cases using boundary value analysis also.
Ans. For a program that calculates the square root of an input integer which can assume values in the range of 0 to 5000 there are three equivalence classes The set of negative integers the set of integers in the range of 0 and 5000 as well as the integers larger than 5000. Consequently the test cases must include representatives for each of the three equivalence classes and a possible test set can be: {-5,500,6000}. Boundary value analysis initiates selection of test cases at the boundaries of the different equivalence classes. For a function that calculates the square root of integer values in the range of 0 and 5000, the test cases must include the following values: {0, -1,5000,5001}.