Question: Exercise 5 : Static Slicing [ 1 0 % ] Consider the following Java code which reads in exam marks from array marks ( values

Exercise 5: Static Slicing [10%]
Consider the following Java code which reads in exam marks from array "marks" (values have been added to this array in preceding code) and prints the number of passes and fails, the sum of all marks, the average mark and the pass rate:7int count =0;for(int i=0;i marks.length;i++){totalMarks =0;if (marks[i]>=40)pass = pass +1 ;if (marks[i]40)fail = fail +1;count = count +1 ;totalMarks = totalMarks+marks[i];}println("Out of"+ count +","+ pass +" passed and "+ fail
" failed.");
println("The sum of all marks is "+ totalMarks);
int average = totalMarks/count;
println("The average is "+ average);
passRate =(pass/count)**100;
println("This is a pass rate of "+ passRate);
a)[6%] The program is not printing a correct average value. Construct the backward slice (at the point of the line of code that prints the average) to locate the root cause for this and correct the code.
b)[4%] Determine whether the corrections you made have any negative effects by constructing suitable forward slices.
 Exercise 5: Static Slicing [10%] Consider the following Java code which

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!