Download Software Engineering and more Exams Software Engineering in PDF only on Docsity!
Final Exam
Software Engineering
Fall 2009
Instructions
- The exam consists of this cover sheet, eleven (11) problems, and two (2) pages of
code. Be sure that you have all of these items and that they are all legible.
- Read all questions and their instructions thoroughly before you begin.
It is always worth your time to plan ahead!
- Write your answers in the spaces provided on the exam.
- Whenever I ask you to answer "... briey...”, a one- to three-sentence answer is long
enough to express the each bullet item.
- Whenever a problem contains multiple parts, be sure that your response includes
answers to each part.
- The exam is worth sixty (60) points total. The point value of each question is given
in brackets immediately after the problem number. You may wish to use these point values as you budget your time across the exam period.
- Points will be awarded based on your explicit answers. Partial credit will be given
where possible, so show all of your work.
- The exam lasts sixty (60) minutes. It is due at 4:00 PM.
Name:
- [6 points] Answer briey each of these questions about refactoring.
- What is refactoring?
- What role does refactoring play in the design of software?
- What is the relationship between refactoring and testing?
2. [6 points] In class, we began to refactor a Customer class for a video rental store sys-
tem. The current version is given at the end of the exam.
- Describe two different refactorings that we could apply to improve this code by
reducing duplication between the statement() and htmlStatement() methods.
- For each of the refactorings, identify at least one programming issue that we would face in trying to ensure that we don’t break the program.
- [6 points] Answer briey each of these questions about the "Writing Maintainable
Automated Acceptance Tests" article by Emery.
- What relationship between maintenance and testing does Emery address?
- Describe the difference between the acceptance test at the beginning of the paper and the acceptance test at the end.
- What tools are needed to implement the sort of tests that Emery describes?
- [4 points] Answer briey these questions about testing as an attempt to demonstrate
a match between the specication for a system and the code that implements the system.
- Identify two clues a tester can take from the specication when writing tests.
- Identify two clues a tester can take from the code when writing tests.
- [6 points] Answer briey these questions about agile methodology, as it relates to
Fowler’s distinction between predictive versus adaptive approaches to software de- velopment processes.
- Describe at least two ways in which agile methodologies are adaptive rather than predictive.
- What risk does a development team incur when it chooses to be adaptive rather than predictive?
- In what ways does extreme programming try to mitigate this risk?
- [6 points] Based on your experience with your team project, answer briey these
questions about the software life cycle.
- Which stage was most difcult? Why? What did your team do in response?
- Which stage was most straightforward? Why?
- [6 points] Identify each of the labeled components in this UML class diagram.
A ___________________________ F ___________________________
B ___________________________ G ___________________________
C ___________________________ H ___________________________
D ___________________________ I ___________________________
E ___________________________ J ___________________________
import java.util.Enumeration; import java.util.Vector;
public class Customer { private String name; private Vector rentals;
public Customer( String name ) { this.name = name; this.rentals = new Vector(); }
public void addRental( Rental arg ) { rentals.addElement( arg ); }
public String getName() { return name; }
public String statement() { double totalCharge = 0; int frequentRenterPoints = 0; String result = "Rental Record for " + getName() + "\n";
Enumeration entries = rentals.elements(); while ( entries.hasMoreElements() ) { Rental each = (Rental) entries.nextElement(); double rentalCharge = each.charge(); frequentRenterPoints += each.frequentRenterPoints();
// show figures for this rental result += "\t" + each.getMovie().getTitle() + "\t" + String.valueOf(rentalCharge) + "\n"; totalCharge += rentalCharge; }
result += "Amount owed is " + String.valueOf(totalCharge) + "\n"; result += "You earned " + String.valueOf(frequentRenterPoints) + " frequent renter points";
return result; }