Question: Read the following Java code fragment for a method which attempts to calculate the number of students having the mark between 1 and 4. ns

Read the following Java code fragment for a method which attempts to calculate the number of students having the mark between 1 and 4.

ns = 0;

I = 0;

while (I <= N) {

if (mark[I] >= 1.0 && mark[I] < 4.0)

ns++;

I++;

}

print ns;

(i) Draw a control flow graph.

(ii) Based on the control flow graph, find the cyclomatic complexity and list all the (linearly) independent paths.

(iii) Prepare a test case for each independent path.

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!