Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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