# Sample final 3

CS321 Fall 2011

## Final Examination

### ________________________________________________________

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.

List two generalizable things that make for a good leader. Then, list two things that make for a good manager. (All four answers should be unique and should be PHRASES no longer than a sentence max). (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 financial risk involved in investing money in the stock market. First, define the expected outcome and the actual outcome. Then, calculate the risk exposure of investing money, 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

3 int i = x.intValue(); for(int j = 0; j < list.length(); j++){

4

5

6 if (i == j) j = j + 1; if (list.get(i).toString().contains("cat"))

7

8

9

10

11 } i = Math.abs(i – 1);

}

System.out.println("list is: " + list);

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. (8 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 should allow easy user authentication. b.

The system will never experience downtime. c.

The system will allow both general and super users d.

The system shall allow a user to keep a record of their order history.

8.

What is an example of a code smell, and what is the refactoring that could fix it? (4 points)

9.

LIST three benefits associated with test-driven unit testing, as opposed to only doing integration testing at the end of a software cycle (6 points)

10.

List two distinct criticisms of why number of methods written is not a good project metric. Then, list two reasons why number of methods written IS a good project metric. (explain each in at most ONE SENTENCE) (8 points)

Part 2: Diagramming

11.

Consider the following specification

The authentication module sends the user a login page. The user enters their name and password, which are checked for emptiness on the client side when the user submits them. If they are not empty, the authentication module validates that the username and password match. If they match, the authentication module sends the user to a search page. If they don’t match, the authentication module prompts the user to re-enter their username and password up to two more times.

As soon as the authentication module receives the login information, it starts a session timer that runs concurrently until the user is successfully validated, at which point the timer is stopped. a.

Write a state diagram for the scenario above (10 points)

b.

Write a sequence diagram for the scenario above, using three classes. (10 points)

Part 3: True/False

12.

Circle TRUE or FALSE for the following statements, and defend your choice in ONE SENTENCE.

(22 points) a.

A use case must have at least two actors.

TRUE FALSE b.

We refactor to fix faults in the code.

TRUE FALSE c.

According to Ray Buse’s paper on readability, code that has low readability is also more likely to have bugs.

TRUE FALSE d.

According to Hovemeyer and Pugh’s paper on the FindBugs tool, there are several bug patterns or idioms that can dynamically find failures in code.

TRUE FALSE e.

According to Yi Wang’s paper on management, neuroticism was negatively correlated with successful project management.

TRUE FALSE f.

According to Keil et. al’s paper on software risk, lack of commitment was the most significant risk factor identified by software project managers.

TRUE FALSE g.

According to the two papers on motivation by Sharp et. al, “monetary factors” were most important for managers, but not developers.

TRUE FALSE

h.

According to the refactoring paper by Murphy-Hill et. al, most refactorings are small and happen incrementally.

TRUE FALSE i.

Pair programming is most commonly associated with Scrum practices.

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