Based on the above code segment, answer the following questions: a. Produce a flow graph based on the above code b. Identify the region c. Calculate the cyclomatic complexity using both formulas and Graph Matrix. i. V(G) = edges - nodes + 2 ii. V(G) = P + 1 d. Identify the independent path e. Provide a test script based on the identified independent path.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Practice on Basis Path Testing
You are given the following code:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
int marks [] = new int [6];
int i;
float total = 0, avg;
Scanner scanner = new Scanner(System.in);
for (i = 0; i < 6; i++) {
System.out.print("Enter Marks of Subject" + (i + 1) + ":");
marks[i] = scanner.nextInt();
total = total + marks[i];
scanner.close();
// Calculating average here
11. avg = total / 6;
14151671819 20 21
}
12.
System.out.print("The student Grade is: ");
13. if (avg >= 80) {
System.out.print("A");
15. } else if (avg >= 60 && avg < 80) {
System.out.print("B");
17.} else if (avg
i.
ii.
>= 40 && avg < 60) {
System.out.print("C");
System.out.print("D");
} else {
}
Based on the above code segment, answer the following questions:
a. Produce a flow graph based on the above code
b. Identify the region
c. Calculate the cyclomatic complexity using both formulas and Graph Matrix.
V(G) = edges - nodes + 2
V(G) = P + 1
d. Identify the independent path
e. Provide a test script based on the identified independent path.
Transcribed Image Text:Practice on Basis Path Testing You are given the following code: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. int marks [] = new int [6]; int i; float total = 0, avg; Scanner scanner = new Scanner(System.in); for (i = 0; i < 6; i++) { System.out.print("Enter Marks of Subject" + (i + 1) + ":"); marks[i] = scanner.nextInt(); total = total + marks[i]; scanner.close(); // Calculating average here 11. avg = total / 6; 14151671819 20 21 } 12. System.out.print("The student Grade is: "); 13. if (avg >= 80) { System.out.print("A"); 15. } else if (avg >= 60 && avg < 80) { System.out.print("B"); 17.} else if (avg i. ii. >= 40 && avg < 60) { System.out.print("C"); System.out.print("D"); } else { } Based on the above code segment, answer the following questions: a. Produce a flow graph based on the above code b. Identify the region c. Calculate the cyclomatic complexity using both formulas and Graph Matrix. V(G) = edges - nodes + 2 V(G) = P + 1 d. Identify the independent path e. Provide a test script based on the identified independent path.
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY