Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1: Using the following source code, answer the questions listed below. 1. public int Funi (int x, int k) { 2. int i=0;

  

Task 1: Using the following source code, answer the questions listed below. 1. public int Funi (int x, int k) { 2. int i=0; 3. int y x+k; 4. do ( 5. if (x/2 < 2) { 6. ky x; 7. } 8. else{ 9. xk2; 10. y = y + x; 11. 12. 13. 14. 15. 16. 17. } 18. kxy: i=i+1; while (ix); if (x < 0 && y < 0) { k-y-x; else{ 19. k = y + x; 20. 21. 22.) } return k; (a) Draw a control flow graph to represent the method Fun!, shown above. Label the nodes (starting with A) and the outgoing edges of the decision boxes appropriately. (b) Using the line labels in the code for method Fun!, identify all the def-use pairs for the variables x, k and y. (c) Identify a set of test cases that satisfies the all-defs criterion, for variables x, k and y in method Funl. Use trace tables to show how the def-use pairs are covered. If you cannot achieve 100% coverage for the all-defs criterion please explain why. (d) Identify a set of test cases that satisfies the all-uses criterion, for variables x, k and y in method Funl. Use trace tables to show how the def-use pairs are covered. If you cannot achieve 100% coverage for the all-uses criterion, please explain why.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer a Heres the control flow graph CFG for the Fun1 method A ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Operations Research An Introduction

Authors: Hamdy A. Taha

11th Edition

0137625723, 978-0137625727

More Books

Students also viewed these Programming questions

Question

In what storage units are files displayed in unix? .

Answered: 1 week ago