Prévia do material em texto
AC16 Software Engineering 79 Test # Description Test Data 1 A valid scalene triangle. a = 2, b = 3, c = 4 2 An illegal triangle with a zero length side. a = 0, b = 1, c = 1 3 An illegal triangle with one short side. a = 1, b = 4, c = 2 4 A valid equilateral triangle. a = 1, b = 1, c = 1 5 A valid isosceles triangle. a = 1, b = 2, c = 2 Q.14 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 computes 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, and the integers larger than 5000. Therefore, 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 leads to selection of test cases at the boundaries of the different equivalence classes. For a function that computes 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}. Q.15 For the structural chart given in fig.1 calculate the Information Flow index of individual modules as well as whole software. Ans: Module Fan-in Fan-out Information Flow index of module(Fan-in*Fan-out) 2 main 2 2 16 A 2 2 16 B 2 2 16 C 2 1 4 l 0 1 0 m 1 1 1 n 0 1 0 x 1 1 1 AC16 Software Engineering 80 y 1 0 0 Total information flow = IF (main) + IF (A) + IF (B) + IF (C) + IF (I) + IF (m) + IF (n) + IF (x) + IF (y) = 16 + 16 + 16 + 4 + 0 + 1 + 0 + 1 + 0 = 54 Q.16 For the flow graph shown in Fig2, compute McCabe’s Cyclomatic Complexity. Ans:In this flow graph, Number of regions are 5, hence the Cyclomatic complexity is = 5 OR No of edges = 10 No of nodes (N) = 7 Hence Cyclomatic complexity + E-N+2 = 10-7+2 = 5 Q 17 Write a program in C to add two numbers and then calculate the values of the following software science metrics : (i) n(vocabulary of a program ) (ii) N (program length) (iii)V(Volume) (iv) L(program level) Ans Void Main() { int i,j,sum scanf(“%d%d”,i,j); sum = i+j; printf(“%d” ,sum);} operators occurrences operands occurrences main() 1 i 2