Question: QUESTION 24 Consider the following faulty program, It includes a test case that results in failure. Answer the following questions about the program. public int

 QUESTION 24 Consider the following faulty program, It includes a test

QUESTION 24 Consider the following faulty program, It includes a test case that results in failure. Answer the following questions about the program. public int countNegative x) Effects: If throw NulPointerException else retum the number of negative elements in x int cot-0 for (int-0: 1 x-length: 1 ) f (s0) return count: / Test Case Input x--4, 2.0,-2] // Expected Output 2 (i) Identify the fault Specify the line of code where the faulty exists. (ii) If possible, identify a test case that does not execute the fault If possible, identify a test case that executes the fault, but does not result in an eror state (v) Fix the fault. Provide the fixed line of code. (Verify that the given Test Case now produces the expected output) TTT ? Paragraph ? Arial

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!