Consider the following source code for which you will compute the initialised variables.

Part I
Question 1 – Answer all subquestions.
Consider the following source code for which you will compute the initialised variables.
int fac(int n) { int f; if (n == 0) { f = 1; } while (n > 0) { f = f * n; n = n – 1; } return f; }
a. Draw the control flow graph for the function above.
You can draw your graph on paper, scan it or take a picture with your phone, and insert it in your document. Alternatively, you can use any drawing tool that can create the required graph.
[3 marks]
b. Give the gen sets for each of the building blocks.
[1 marks]
c. How is the incoming and the outgoing data flow (in and out) of a basic block computed?
Is the given problem a may or a must data flow problem? Explain why.
[2 marks]
d. Compute the final values for the in and out sets of each building block.
e. Give the values of the sets after each iteration of the computation.
[7 marks]
f. Which problem in the source code can be identified from the in sets?
[2 marks]
g. Give the definition of McCabe’s cyclomatic complexity and show how it is computed on the above program.
[2 marks]
h. Consider branch coverage.
i. How is McCabe’s cyclomatic complexity related to branch coverage for a single function?
[4 marks]
ii. Compute the branch coverage for the following four calls:
• fac(-1)
• fac(0)
• fac(1)
• fac(2)
[2 marks]
iii. Give a combination of calls that achieves full branch coverage.
[2 marks]
[Total for Question 1: 25 marks]
Question 2 – Answer all subquestions.
The string 𝐴=“abcdefg” has been replaced by the string 𝐵=“efgabcdbc”.
a. Give the distance matrix 𝐷 that DIFF uses to compare the two strings 𝐴 and 𝐵.
[6 marks]
b. How many edit operations are necessary to transform “abcdefg” to “efgabcdbc”?
[1 marks]
c. Give a sequence of edit operations to transform “abcdefg” to “efgabcdbc”?
[2 marks]
d. Let 𝐶 be the concatenation of 𝐴 and 𝐵, i.e., 𝐶=𝐴𝐵. Give the suffix array for 𝐶.
[6 marks]
e. How can suffix arrays be used to find “cloned” text? Explain and use the above suffix array as an example to find cloned text which is at least three letters long.
[5 marks]
f. Can suffix arrays be used to identify the differences between 𝐴 and 𝐵? Explain your answer.
[5 marks]
[Total for Question 1: 25 marks]
Part II
Read the article “Software Engineering at Google” by Fergus Henderson which describes Google’s key software engineering practices.
In Chapter 2, eleven key practices are presented. From the eleven practices pick 10. For each practice clearly state the practice and then reflect how the described practice compares to what you have learnt in the lectures. In particular, highlight when a practice differs from what you have learnt and discuss the potential positives and negatives of the different practices.
Your discussion of the 10 practices should not be longer than 2000 words and each of the 10 practices should be discussed in 100 to 300 words.
For each of the 10 practices you can achieve up to 5 marks and you can achieve up to 50 marks in total for Part II.
[50 marks]

Calculate a fair price for your paper

Such a cheap price for your free time and healthy sleep

1650 words
-
Place an order within a couple of minutes.
Get guaranteed assistance and 100% confidentiality.
Total price: \$78
We offer