CpSc 372
Exam 2
Name______________________________________________
Answer any FIVE of the six questions. If you answer all six, one of them will NOT be graded. All questions are counted the same: 20 points each.
Pre: argument >=0
Float sqrt(float argument)
Post: return = argument^.5
A constraint language does not allow side effects so variable values are not changed
The pre-condition establishes the initial conditions for the test case. The port-condition is the expected result.
Reviews and inspections are conducted before code is written and testing requires code. A review is a high-level examination of the design model/architecture while an inspection is much more detailed.
Test cases will vary with each student. The source of the test cases was the use case model.
-
Review use case model and select representative
use case scenarios
Input: use cases Output: selected scenarios
-
For each scenario, walk through the model action
by action. Draw sequence diagram to capture it
Input: scenario and
model Output: list of variances between
the scenario and model
-
Create analysis of test failures
Inputs: results of all
walk-throughs Outputs:A report
Maintainability
Modifiability
Minimal complexity



I choose option 1. The separate event handling class separates concerns. The GameBoard class has only a single object that is automatically invoked by the event handling mechanism. This approach makes maintenance easier since a single class is the source. The behavior is easily modified by replacing a single object.
Public int largest(int a, int b, int c)
{
if (a > b){
if(a > c){
return a;
}
else{
if(c > b){
return c;
}
}
else{
if(b > c){
return b;
}
else{
return c;
}
}
}
a = 5, b= 3, c=2
a = 5, b= 2, c=3
a = 5, b= 6, c=9
a = 5, b= 9, c=6
a = 5, b= 3, c=2
a = 5, b= 3, c=6
a = 5, b= 7, c=2
a = 5, b= 7, c=9
Any one of the above test cases. The entire listing is one statement.
The size of a system makes it impractical to attempt to follow a path through the entire program.
Main scenario – The gamePlayer starts the game, moves the paddle so that the puck bounces on it, eventually the bricks are all destroyed. A dialogue is displayed indicating that the gamePlayer won.
Alternative scenario – The gamePlayer starts the game, moves the paddle so that the puck bounces on it. Then the gamePlayer presses the left mouse button and pauses the game. Eventually the gamePlayer releases the mouse button and continues until all the bricks are broken. A dialogue is displayed indicating that the gamePlayer won.
Exceptional scenario – The gamePlayer starts the game and presses EXIT before pressing START. The game exits.
Write one test case for each scenario. Be sure to include the three parts of a test case for each scenario.
Main test case –
pre-conditions:
not Game.running()
inputs: mouse
moves
expected
result: screen is clear except
for paddle and puck and dialogue
Alternative test case –
pre-conditions:
not Game.running()
inputs: mouse moves, button
press, and button release
expected
result: all movement frozen on
the screen; screen is clear except for paddle and puck and dialogue
Exceptional test case –
pre-conditions:
not Game.running()
inputs: mouse
moves and a button press
expected result: GameBoard disappears
Both contain the same basic activities. Both list those activities in the same order, initially.
The number of time each activity is exercised.
Each model would develop a segment of the final required functionality using the single exercise of activity and multiple exercise of activity respectively. Then each would take another segment and add it to the first using the same approach. This would continue until all functionality is completed.