Question: Code Coverage: Consider the following code (expressed as a control-flow graph) for computing the greatest common denominator (GCD) of integers x and y: The inputs

Code Coverage:
Consider the following code (expressed as a control-flow graph) for computing the greatest common denominator (GCD) of integers x and y:
Code Coverage: Consider the following code (expressed as a control-flow graph) for
The inputs to this code are the x and y values read in statement 1 and 2, so any (x,y) pair constitutes a possible test case.
(a) If x is fixed at 6, then what is the smallest possible positive value of y that gives 100% statement coverage? Your answer should be a single test case, i.e., a single (x,y) pair with the restriction that x must be 6. Using 6 for x and your chosen value for y, what is the sequence of statement numbers (e.g., 1, 2, etc.) that execute when this test case is run?
(b) Is it possible to achieve 100% data-flow (def-use) coverage for our GCD program with a single test case (i.e., a single (x,y) input pair)? Explain your answer: describe such a test if your answer is "yes" and explain why not otherwise.

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!