# Sample final 1

```CS321 Fall 2011
Dr. Kinga Dobolyi
Section 002
Final Examination
Student Name: ____________________________________________________
Student G#: ______________________________________________________
Student signature for Honor Code:
________________________________________________________
Part 1: Short Answer. DO NOT REPEAT the question in the answer for full credit. LIST means
used a bulleted list – writing in a paragraph will not receive full credit.
1. What is the single responsibility principle?(4 pts)
2. List 5 causes of project failure, that we have discussed this semester, and in ONE SENTENCE (or
less) explain what each one is. (10 points)
3. There is a risk involved in eating breakfast before the final. First, define the expected outcome
and the actual outcome. Then, calculate the risk exposure of eating breakfast before the final,
using numeric units. Then, using this example, explain the four treatments we could apply to
this risk. Finally, calculate the cost of each of those treatments (in terms of executing the
treatment) in the same units you used for risk exposure calculations. Finally, which treatment
would you choose to apply and why? (24 points)
Expected outcome:
Actual outcome:
Risk exposure:
Treatment
Treatment chosen and why:
Cost of
Treatment
4. Calculate the cyclomatic complexity of the following code (show your work for partial credit – 6
points):
1
public void run(Integer x, ArrayList list){
2
int i = x.intValue();
3
for(int j = 0; j &lt; i; j++){
4
if (list.get(i).toString().contains(&quot;hi&quot;))
5
i = 5;
6
if (list.get(i).toString().contains(&quot;hic&quot;))
7
i = 6;
8
else
9
i = 7;
10
}
11
System.out.println(&quot;i is: &quot; + i);
12
}
5. For the previous code, create a test suite that achieves full BRANCH coverage. For full credit, use
the minimal number of test cases in your test suite. (10 points)
6. For the previous test suite, how many different PATHs are there through the code? Does the size
of the incoming list matter? Explain why or why not. (5 points)
7. Examine the requirements below. For each one, describe why it is a good requirement, even if
we didn’t know what the system was that was actually doing or being used for. Then describe
whether it is a functional or non-functional requirement. (12 points)
a. The system might have to handle new users.
b. The system will operate 365 days a year
c. The system will process VISA and Mastercard credit cards
d. The system will be 508 compliant.
8. What is an example of a task you would not want on the critical path in a schedule, and why? (4
points)
9. First, define what mutation testing is. Then, give an example (as source code) of an error that
mutation testing will not help uncover. Then, give an example (as source code) of an error that
mutation testing would help uncover. For this example, limit your mutation operators to
changing anything in an if-guard only. (8 points)
What is mutation testing:
Mutation testing will NOT help find this fault
Mutation testing WILL/COULD help find this fault
10. List three distinct criticisms of why lines of code written is not a good project metric. Then, list
one reason why lines of code written IS a good project metric. (explain each in at most ONE
SENTENCE) (8 points)
Part 2: Diagramming
11. Consider the following specification
The module has Customer, Website, and Database classes. The Customer chooses a type
of item to look up on the Website. The Website consults the Database to see if these
items are in stock, and if they are, returns all items that match the search parameter. If
no items match the search parameter, the Database will return an error message to the
Website, which the Website sends to the Customer. Otherwise, the Website formats the
results in a pretty manner and displays them to the Customer. While the Customer is
waiting for the result, the Website will (at some point between receiving the search
request from the Customer and returning the result) send a separate request to the
Database to log the timestamp, but it will NOT wait for a reply from the Database that
the logging has completed.
a. Write a sequence diagram for the scenario above (10 points)
b. Write a swimlane diagram for the scenario above (10 points)
c. Write a class diagram for this same scenario (copied here for your convenience). You
MUST include return types for all methods, and types for all variables/parameters. (12
points).
The module has Customer, Website, and Database classes. The Customer chooses a type
of item to look up on the Website. The Website consults the Database to see if these
items are in stock, and if they are, returns all items that match the search parameter. If
no items match the search parameter, the Database will return an error message to the
Website, which the Website sends to the Customer. Otherwise, the Website formats the
results in a pretty manner and displays them to the Customer. While the Customer is
waiting for the result, the Website will (at some point between receiving the search
request from the Customer and returning the result) send a separate request to the
Database to log the timestamp, but it will NOT wait for a reply from the Database that
the logging has completed.
Part 3: True/False
12. Circle TRUE or FALSE for the following statements, and defend your choice in ONE SENTENCE.
(22 points)
a. Risk avoidance means we lessen the impact of a risk
TRUE
FALSE
b. Risk reduction means we lessen the likelihood or the impact of a risk
TRUE
FALSE
c. A error must exist in order for a failure to happen.
TRUE FALSE
d. We expect Defect Removal Efficiency to be lowest during the implementation
phase. TRUE FALSE
e. Scrum uses sprints to work on a small set of requirements at a time.
TRUE FALSE
f. There are no documented requirements with agile process models.
TRUE FALSE
g. State diagrams must have a trigger between states.
TRUE FALSE
h. The process model used for your semester projects was a prescriptive model.
TRUE FALSE
i.
Use cases should be used as the basis for system testing.
TRUE FALSE
j.
In the planning game, customers estimate how long it will take to implement a
feature.
TRUE FALSE
k. I write my name on all exams.
TRUE FALSE
```