CS132 Software Engineering Midterm Exam
CS132 Software Engineering Midterm Exam
Midterm Exam
There are 7 problem sets and the total points are 80 points. Your score will be divided by 4 to
reflect the 20% constitution for the midterm. Each problem set includes a few questions. For each
question, the maximum possible points are stated.
Please write your answers legibly on the answer booklet so that we can read and understand
your answers. If a problem seems ambiguous, please feel free to state your assumption explicitly
and solve the problem. Obviously, your assumption should be reasonable and should not trivialize
the problem.
Pledge. Copy the following pledge and sign your name in your answer booklet:
1
Problem 1. (10 pts)
Below is an use case diagram which describes functionality expected from the system to be devel-
oped. Please answer the following questions.
1. (2 pts) Describe the relationship between use case A and use case E. When actor O execute
use case A, is it necessary to execute the use case E?
2. (2 pts) Describe the relationship between use case C and use case B. When actor L execute
use case C, is it necessary to execute the use case B?
3. (2 pts) Describe the relationship between use case C and use case H. Can use cases H be
executed by actor N?
4. (4 pts) From the point of view of user M, which of the use cases may be executed?
Answer:
4. J, B, C, H, F, I
2
Problem 2. (10 pts)
Figure 2 describes the process when students want to register for an exam. Please answer the
following questions.
1. (2 pts) What kind of UML Diagram it is? What is the difference between it and State Machine
Diagram?
2. (2 pts) Write down the condition “[else]” explicitly. i.e. when will this partition of the diagram
execute.
4. (4 pts) Assume there is a place available on the waiting list and one student decides to register
for the exam. The student will go through the process illustrated in the diagram above and
generate a trace. Mark the messages on the trace with ”x”. Note that the trace will only
cover part of the diagram.
3
Answer:
1. Sequence diagram. Sequence diagram only represent one particular execution path, however,
state machine diagram try to cover all relevant behaviors.
2. [status== not ok && wait list full]. “alt” represents if-else, and “opt” represents “if without
else”.
4
Problem 3. (10 pts)
Below is the UPPAAL model for a light controller which consists of two templates.
Determine whether the properties below are True or False, and briefly explain your choices.
1. (2 pts) A[ ] not deadlock
2. (2 pts) E[ ] [Link]
3. (2 pts) E<> ([Link] and Light.x>3)
4. (2 pts) A<> [Link]
5. (2 pts) A<> [Link]
Answer:
1. Answer: true
2. is it possible that the the light is always OFF. Answer: true, no pressing the button
3. it is possible that the light isn’t pressed a second time within 3secs after it’s turned on.
Answer: true, there is no constraints for pressing the button
5
4. no matter how your operate the light, it will eventually go to OFF. Answer: , true, the initial
state is OFF
5. no matter how your operate the light, it will eventually go to BRIGHT. Answer: , false, if
every two presses have more than 3 sec delay
6
Problem 4. (5 pts)
If we have computational tree like Fig. 6
Please 1) describe the meaning of the following TCTLs, 2) determine true or false and 3) explain
why.
1. (1 pt) A [ ] 1
2. (2 pts) A <> 1
3. (1 pt) E [ ] 3
4. (1 pt) E <> 4
Answer:
7
Problem 5. (20 pts)
A test case (also called test vector) is an assignment of values to all program variables at the
beginning of the code. Consider the following code segment:
(a) (10 points) What is the minimum number of test cases needed for a complete coverage in branch
(decision) testing? Provide a complete set of such test cases and justify.
Answer:
Two. There are three branches.
A=1, B=1, X=7 make the three branches, T, T, F.
A=1, B=0, X=2 make the three branches, F, F, T.
Grade Guideline: -3points if the minimum number is wrong.
(b) (10 points) What is the minimum number of test cases needed for a complete coverage in
condition testing? Provide a complete set of such test cases and justify.
Answer:
Two. There are six conditions. One is A=4, B=1, X=7, which makes A < 2 false, x <= 4
false, and the other conditions true. The other is A=1, B=2, X=1, which makes A < 2 true,
x <= 4 true, and the others false. and other conditions false.
Grade Guideline: -3points if the minimum number is wrong.
8
Problem 6. (10 pts)
For the following program and corresponding data flow diagram, please write down All-p-use with
respect to variable Y.
Answer:
The complete paths include 1,2,3; 1,2,7; 4,6,2,3; 4,6,2,7;
1→2→7→8;
1→2→3→4→6→2→3→4→6→2→7→8;
9
Problem 7. (15 pts)
Assume t is a defined clock, there are 6 different UPPAAL models shown in the figure. For each
model, write down whether the model has deadlock. For the model(s) you think have deadlock,
please explain the reason for deadlock.
Answer:
A. Yes, A may not be able to enter B
B. Yes, A may not be able to enter D
C. No
D. No
10
E. Yes, A may not be able to enter B
F. No
11