0% found this document useful (0 votes)
2 views11 pages

CS132 Software Engineering Midterm Exam

The CS132 Software Engineering midterm exam consists of 7 problem sets totaling 80 points, with a score reflecting 20% of the midterm grade. Students must answer various questions related to use case diagrams, UML diagrams, UPPAAL models, and testing strategies. The exam emphasizes clarity in answers and includes a pledge against cheating.

Uploaded by

aoli2wei
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

CS132 Software Engineering Midterm Exam

The CS132 Software Engineering midterm exam consists of 7 problem sets totaling 80 points, with a score reflecting 20% of the midterm grade. Students must answer various questions related to use case diagrams, UML diagrams, UPPAAL models, and testing strategies. The exam emphasizes clarity in answers and includes a pledge against cheating.

Uploaded by

aoli2wei
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CS132: Software Engineering

Midterm Exam

13:00-14:40, April 8th, 2019

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:

I neither cheated myself nor helped anyone cheat on this exam.

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.

Figure 1: Use Case Diagram

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:

1. Use case A includes a use case B. Yes.

2. Use case B is in an ¡¡extend¿¿ relationship with a use case C. Not necessary

3. H inherits from the use case C. Yes.

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.

Figure 2: Exam Registration

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.

3. (2 pts) What is the difference between Operator “alt” and “opt”?

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”.

Figure 3: Exam Registration

4
Problem 3. (10 pts)
Below is the UPPAAL model for a light controller which consists of two templates.

Figure 4: Light Model

Figure 5: Button Model

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

Figure 6: One computational tree

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:

1. False. There are 2s and 3s.

2. True. Every paths has at least a 1.

3. False. There is no paths consist of only 3s.

4. False. There is no 4s.

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:

IF (A<2) && (B==1)


THEN X=X/A;
END;
IF (A>=4) || (X==7)
THEN X=X-2;
END;
IF (B<2) && (X<=4)
THEN X=A;
END;

(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.

Figure 7: A short program and corresponding Data Flow

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.

Figure 8: 6 UPPAAL models a-f

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

You might also like