(a) Draw a control-flow graph for the following program: int search (string A[], int N, string...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(a) Draw a control-flow graph for the following program: int search (string A[], int N, string what) { int index = 0; if ((N == 1) && (A[0] what)) { return 0; } else if (N = 0) } { return -1; } else if (N> 1) { == while (index < N) } return -1; { if (A[index] } == else index++; what) { return index; } (b) Write test suits (i.e., sets of test cases) that provide statement and branch coverage over the code respectively. For each coverage criterion, please argue why your test suit meets the criterion. [Hint: for each test suite, you need to give at least one test case. Here for the test cases you only need to provide test inputs, but not test oracles, i.e., the expected outputs] (a) Draw a control-flow graph for the following program: int search (string A[], int N, string what) { int index = 0; if ((N == 1) && (A[0] what)) { return 0; } else if (N = 0) } { return -1; } else if (N> 1) { == while (index < N) } return -1; { if (A[index] } == else index++; what) { return index; } (b) Write test suits (i.e., sets of test cases) that provide statement and branch coverage over the code respectively. For each coverage criterion, please argue why your test suit meets the criterion. [Hint: for each test suite, you need to give at least one test case. Here for the test cases you only need to provide test inputs, but not test oracles, i.e., the expected outputs]
Expert Answer:
Answer rating: 100% (QA)
Answer a Controlflow graph CFG for the given program index 0 V N 1 A0 what V return 0 V N 0 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
If a natural disaster, such as the 2010 drought in Russia, hits food production, use supply and demand analysis to figure out how this affects consumers and producers. Does everyone lose or are some...
-
What are the steps the NLRB follows in a representation election?
-
Select the graph that matches the numbered manufacturing cost data. Indicate by letter which graph best fits the situation or item described. The vertical axes of the graphs represent total cost and...
-
During the Covid19 pandemic, some people wondered why biologists seemed unable to answer many questions about the virus, including why children rarely became seriously ill, why men were more likely...
-
Kao Tiles, Inc. is a specialized producer of ceramic tiles. Its production process involves highly skilled workers and top-quality ceramic craftsmen. Work in Process is relatively large because each...
-
The story is rich dad poor dad chapter 3 1) What is rule #1? 2) What is an asset? Give 3 examples. 3) What is the difference between an asset and a liability? 4) According to "Rich Dad", when can a...
-
The amount of tea leaves in a can from a particular production line is normally distributed with = 110 grams and a = 25 grams. a. What is the probability that a randomly selected can will contain at...
-
Select a car of your choice, find the list price, and calculate 5% and 10% price offers. Check out available money sources in your community, and prepare a report showing the different costs for the...
-
In Problems 20-52: a. State the type; and \(\mathbf{b}\). Answer the question. You deposit \(\$ 300\) at the end of each year into an account paying \(2 \%\) compounded annually. How much is in the...
-
Conduct a survey of banks, savings and loan companies, and credit unions in your area. Prepare a report on the different types of savings accounts available and the interest rates they pay. Include...
-
You attach a \(0.50-\mathrm{m}\) length of string to a \(50 \mathrm{~g}\) puck and pass the other end of the string through a hole in the center of a table. Grasping the string under the table, you...
-
A light, unstretchable string is wound around the perimeter of a \(4.0-\mathrm{kg}\) disk that has a radius of \(0.50 \mathrm{~m}\) and is free to rotate about an axle that runs perpendicular to the...
-
9 Use your knowledge of carbonyl chemistry and reaction mechanisms to explain the following biological transformation. The C(-0)SCOA unit is a thioester (The OR unit of an ester is replaced by an SR...
-
Consider the function f and its graph. a. Estimate the zeros of the area function b. Estimate the points (if any) at which A has a local maximum or minimum. c. Sketch a graph of A, for 0 x 10,...
-
Using convolution find \(y[n]\) given 1 ()", (3)", n h[n] y[n] =x[n] h[n] x[n] || || u[n]
-
What is the inverse \(z\)-transform of \(X\left[\frac{z}{a}ight]\) ?
-
Mention the steps to be followed to realize a transposed structure from canonic form structure.
-
Describe how competence, caring, and character affect your credibility as a communicator.
-
Explain the importance of establishing credibility for business communications.
-
Define and explain business ethics, corporate values, and personal values.
Study smarter with the SolutionInn App