a. b. C. shows a sample code. int binsearch (int X, int VII, int n) {...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a. b. C. shows a sample code. int binsearch (int X, int VII, int n) { int low, high, mid; low - 0; ii. high = n - 1; while (low < high) { mid= (low+ high)/2; if (X < V[mid)) high-mid - 1; else if (x > V[mid)) low - mid + 1; else return mid; } return -1;) FIGURE Q3 (i) For FIGURE Q3 (i), draw a detail of: i. control flow chart control flow graph (CFG). From the CFG, identify set of entry-exit paths that satisfy complete statement coverage criterion i ii. complete branch coverage [2 marks] [2 marks] [2 marks] [2 marks] Discuss TWO (2) possible faults in the routine so that these go undetected by your test cases designed for complete branch coverage [4 marks] d. e. Calculate the cyclomatic complexity of the graph in FIGURE Q3 (i). [NOTE: Show all calculation steps clearly.] FIGURE Q3 (ii) shows a modified code for FIGURE Q3 (i). Identify a data flow anomaly in the code given. [NOTE: Support your answer with detail data flow graph (DFG).] int modifiedbinsearch (int X, int V[], int n) { int low, high, mid; low= 0; high n 1; while (low V[mid]) [4 marks] low mid + 1; else return mid; } return -1;) FIGURE Q3 (ii) [4 marks] a. b. C. shows a sample code. int binsearch (int X, int VII, int n) { int low, high, mid; low - 0; ii. high = n - 1; while (low < high) { mid= (low+ high)/2; if (X < V[mid)) high-mid - 1; else if (x > V[mid)) low - mid + 1; else return mid; } return -1;) FIGURE Q3 (i) For FIGURE Q3 (i), draw a detail of: i. control flow chart control flow graph (CFG). From the CFG, identify set of entry-exit paths that satisfy complete statement coverage criterion i ii. complete branch coverage [2 marks] [2 marks] [2 marks] [2 marks] Discuss TWO (2) possible faults in the routine so that these go undetected by your test cases designed for complete branch coverage [4 marks] d. e. Calculate the cyclomatic complexity of the graph in FIGURE Q3 (i). [NOTE: Show all calculation steps clearly.] FIGURE Q3 (ii) shows a modified code for FIGURE Q3 (i). Identify a data flow anomaly in the code given. [NOTE: Support your answer with detail data flow graph (DFG).] int modifiedbinsearch (int X, int V[], int n) { int low, high, mid; low= 0; high n 1; while (low V[mid]) [4 marks] low mid + 1; else return mid; } return -1;) FIGURE Q3 (ii) [4 marks]
Expert Answer:
Answer rating: 100% (QA)
Answer Given Below is the CGF of the provided function the pa... View the full answer
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
If possible, completely factor the expressions in Problems 336. x - 7x + 12 X
-
Prairie Park ASA was started on April 1 by F. L. Wright and associates. The following selected events and transactions occurred during April. Apr. 1 Shareholders invested 50,000 cash in the business...
-
Firm N has a current ratio of 1.7 and current assets of $141,100. Required: Calculate Firm Ns current liabilities and working capital.
-
Explain the concept of cross-docking.
-
The following account balances are for William Giese, Certified Public Accountant, as of April 30, 2019. Cash..........................................................................$60,000 Accounts...
-
Founded in 1960, the Arpeggio Music Company is a family-owned and operated firm specializing in the educational music market. Located in the U.S. Middle West, its products and services include...
-
Larry has severe vision problems and, in the past, he has claimed the additional standard deduction available to blind taxpayers. This year Larrys doctor prescribed a new type of contact lens that...
-
how do the interests of employers and workers converge and diverge around the issue of training? Use examples to illustrate your
-
. Newly issued government bonds are sold through a) yield based auction b) price based auction c) order driven mechanism
-
9. Write a script that calculates the squares and cubes of the numbers from 6 to 11 and outputs HTML5 text that displays the resulting values in an HTML5 table format, as show below. [Note: This...
-
Let G = (V, E) be an undirected, acyclic, connected graph (that is, a tree). For any vertex v EV, the eccentricity of u is the length of a longest path from u to any other vertex of G. A vertex of G...
-
Cradock plc has operated a pension scheme for its employees for several years. Under the terms of the scheme, Cradock plc is contractually obliged to make an annual contribution equal to 7% of total...
-
SHOW ALL YOUR SUPPORTING CALCULATIONS! You may do this either within the cell by using formulas, out to the right, or both-clearly labeling your work. All your work must be shown on this sheet, not...
-
Which of the following goals would be the easiest to implement and measure its accomplishment? Multiple Choice "Reduce our debt payments." "Save funds for an annual vacation." "Save $100 a month to...
-
Determine by direct integration the values of x for the two volumes obtained by passing a vertical cutting plane through the given shape of Fig. 5.21. The cutting plane is parallel to the base of the...
-
Translate the following C code to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A...
-
Calculate (1.666015625 10 0 1.9760 10 4 ) + (1.666015625 10 0 -1.9744 10 4 ) by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and...
-
Assume a program requires the execution of 50 106 FP instructions, 110 106 INT instructions, 80 106 L/S instructions, and 16 106 branch instructions. The CPI for each type of instruction is 1, 1,...
-
Using the online code for the example in this chapter as a starting point and the solution from a previous exercise. 1. Implement (or modify your previous) Student: :DropCourse (). When a student...
-
What other examples can you imagine that might easily incorporate the Factory Method pattern?
-
Using the solution from a previous exercise, augment your code as follows: 1. Implement the Factory Method pattern to create various shapes. You will have already created an abstract base class of...
Study smarter with the SolutionInn App