Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Justify: What would be the effect if you replace && in line 3 with a & ? ( 3 Points ) b) Create the

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

How can you defend against SQL injection attacks?

Answered: 1 week ago

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago