Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 5 : Static Slicing [ 1 0 % ] Consider the following Java code which reads in exam marks from array marks ( values
Exercise : Static Slicing
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:int count ;forint i;i marks.length;itotalMarks ;if marksipass pass ;if marksifail fail ;count count ;totalMarks totalMarksmarksi;printlnOut of count pass passed and fail
failed.";
printlnThe sum of all marks is totalMarks;
int average totalMarkscount;
printlnThe average is average;
passRate passcount;
printlnThis is a pass rate of passRate;
a 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 Determine whether the corrections you made have any negative effects by constructing suitable forward slices.
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