Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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
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