Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) Justify: What would be the effect if you replace && in line 3 with a & ? ( 3 Points ) b) Create the
a) Justify: What would be the effect if you replace && in line 3 with a & ? ( 3 Points )
b) Create the control flow graph of the method median(...) . Please write the source code, references to the line numbers of the method are not sufficient. ( 8 Points )
c) Specify a test case (minimum input numbers) which satisfies the statement coverage for the method median (...) . Enter the paths that have been traversed. ( 4 Points )
Given the following method 01 public static double median (double] d) f 02 double median - Double.NaN 03 if (d != null && d. length > 0) 04 if (d.length1) f 05 06 else f 07 Arrays.sort(d); // sorted ascending 08 int mid d.length / 2; 09 if (d.length % 2 !-9) { 10 11 else f 12 mediand[e]; median dlmid], median = (d[mid - 1] + d[mid]) / 2; 14 16 return median; a) Justify: What would be the effect if you replace "&&" in line 3 with a "&"? (3 Points) b) Create the control flow graph of the method median(...). Please write the source code, references to the line numbers of the method are not sufficient. (8 Points) c) Specify a test case (minimum input numbers) which satisfies the statement coverage for the method median (...). Enter the paths that have been traversed. (4 Points) Given the following method 01 public static double median (double] d) f 02 double median - Double.NaN 03 if (d != null && d. length > 0) 04 if (d.length1) f 05 06 else f 07 Arrays.sort(d); // sorted ascending 08 int mid d.length / 2; 09 if (d.length % 2 !-9) { 10 11 else f 12 mediand[e]; median dlmid], median = (d[mid - 1] + d[mid]) / 2; 14 16 return median; a) Justify: What would be the effect if you replace "&&" in line 3 with a "&"? (3 Points) b) Create the control flow graph of the method median(...). Please write the source code, references to the line numbers of the method are not sufficient. (8 Points) c) Specify a test case (minimum input numbers) which satisfies the statement coverage for the method median (...). Enter the paths that have been traversed. (4 Points)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started