Assignment 2 Sample Solution

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Assignment #2 Sample solution

Due date: 10/10/2023 at 23.55

Question #1
Given is the following statement, while version control systems have advanced in the last couple
of years, fully automated merging remains a challenge and is typically not recommended.
Is the above statement correct – briefly justify your answer (max 50 words)
Yes.
While fully automated merging might be able to check for syntactical correctness it cannot
check for semantical correctness. Also if we have conflicting code regions (meaning
statements which were modified in parallel), fully automated merging might overrride
changes made by another users.

Question #2
You are attending a workshop and one of the presenters makes the following statements. 1.)
Dependency management systems such as Maven will help managing build dependencies and
the automation of the build process. 2.) Such build management system will also remove
technical debt, by eliminating all built errors.
Clearly indicate, if you agree / disagree with the above statement. Briefly justify your answer (1-
2 sentences).

1.) This is correct. Build management tools allow for the automation of the build process
and mange the dependency needed to build a system.

2.) This is incorrect. Build errors are not technical debt. Technical debt is not related to
system faults or errors. And buildmangement tools do not address issues of technical
debt. They are typically bad coding practices which will make the comprehension and
longterm maintenance of software systems more difficult.
Question #3

Given is the following program and PDG

Verify the above static PDG for correctness – Note: In situation where you have a transitive
control dependency you can ignore it => A is control dependent on B and B is control dependent
on C then you do not have to include the control dependency between A and C.

Indicate in the table next page what is missing/wrong


====PLEASE COMPLETE THE PDG TABLES BELOW (IT MATCHES THE PDG FROM THE PREVIOUS PAGE)

PLEASE COORECT THE PDG BY ADDING MISSING DEPENDENCIES, REMOVING WRONG DEPENDENCIES IN THE TABLE BELOW

WRONG DEPENDENCIES – FILL THE BOX ; ADDING A MISSING DEPENDENCIES USE A CIRCLE SEE EXAMPLE BELOW

ORIGINAL CORRECTED

Is data dependent Is data dependent


1. Y =10 on on
2. IF (Y) 1 2 3 1 2 3
1 1
Node

Node
3. Y=Y+1;
2 X 2 X
3 X 3

;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1
2
3
4 x x x x
5 x x x x
6
7
Node

8 x x x
9 x x
10
11 x x x x x
12 x x
13 x x
14 x x x
15 x
Data Dependencies

Control Dependencies

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1
2
3
4
5 x
6 x
7 x
Node

8 x x
9 x
10 x
11
12 x x
13
14
15
Question #4

Given is the following PDG


a.) Compute a static Backward slice for Node 7
Slice = { 1,2,3,4,5,6,7,11,12} – marked in green

b.) Compute a static Forward slice for Node 7


Slice = {4,5,6,7,8,9,10,11,12,13,14,15 } => marked in yellow.

You might also like