University of Waterloo Final Examination SAMPLE SOLUTION SET Term: Fall Year: 2005 Student Name UW Student ID Number Course Abbreviation and Number Course Title Sections Instructor Date of Exam Time Period Duration of Exam Number of Exam Pages Exam Type Additional Materials Allowed CS445/E&CE451/SE463 Software Requirements Specification and Analysis 001 Nancy Day Thursday, December 22, 2005 Start time: 9:00 a.m. End time: 11:30 a.m. 2 hours 30 minutes 14 pages (including this cover page) Closed book NO ADDITIONAL MATERIALS ALLOWED • Write your name and student number at the bottom of every page. • Write all solutions on the exam. • Happy holidays! Question Mark 1 Name Max Marker 1 Question Mark Max Marker 4.4 4 2 13 5 8 3 8 6 10 4.1 7 7 8 4.2 13 8 7 4.3 13 9 8 Total 100 UW Student ID Number (page 1 of 14) 2 (13 Marks) Short Answer: Concepts 1. (2 marks) Fill in the blanks: Two good criteria for concept (class) diagrams are: • low coupling • high cohesion 2. (4 marks) For each of the following diagram types, check “yes” if it describes end-toend system behaviour (from a user input to a user output). Check “no” if it does not. yes no √ Message sequence chart √ System state diagram √ State diagram for a class √ Class diagram √ Communication (collaboration) diagram 3. (2 marks) Fill in the blanks: Inspections are more effective than testing for finding bugs because inspections find the causes of errors, whereas testing finds the symptons of errors. 4. (1 mark) What is the maximum time that a formal inspection meeting should last? 2 hours Name UW Student ID Number (page 2 of 14) 5. (2 marks) What is the difference between active reviews and formal inspections? Formal inspections have the author present his or her document. In an active reviews, someone other than the author presents the document and answers questions about it. 6. (2 marks) What is the difference between simulation and formal validation? Formal validation checks all behaviours of a model. Simulation only checks one behaviour (scenario) of a model. Name UW Student ID Number (page 3 of 14) 3 (8 Marks) Consistency of UML Diagrams Complete the concept-level UML sequence diagram below given the following concept-level state diagrams. (The sequence diagram should stop when the system would require more inputs before it can change state.) Any non-directed events are broadcast to all objects. State diagram for Class C1: State diagram for Class C2: A a/p:=createC2 r/p.f r B /p.y y/e K e/r C e/q:=createC2 G D /q.y L J r/q.f f/r r/p.f r/f E e/q.f F <<actor>> :User :C1 1: a 2: create() P:C2 3: y 4: e 5: create() Q:C2 6: y 7: e 8: f 9: r 10: f 11: r Name UW Student ID Number (page 4 of 14) 4 (37 Marks) SDL and UML Specification Please read the problem description for Question #4 on the problem description handout. Your solution must be consistent across all parts of this question. An event in the problem description may be treated as a signal in SDL models, and vice versa. 4.1 (7 Marks) SDL Block Diagram Assume that the system consists of one block called BabyMonitoringSystem. Show the block diagram decomposing BabyMonitoringSystem into two processes: a process for the base station software and a process for the remote unit software. Block BabyMonitoringSystem SIGNAL BatteryLow, BatteryDead, BatteryReplaced, TwoWay,OneWay,StartTalk,StopTalk, PwrOn,PwrOff, Noise, Check,BabyAlarm,Ok, SendSound(integer), ReceiveSound(integer), Baby Beep, Alarm; [Beep] [Noise] Base Station Hardware Interface Base Base Station User [SendSound,ReceiveSound] Station [BatteryLow,BatteryDead, BatteryReplaced, TwoWay,OneWay, StartTalk,StopTalk, PwrOn,PwrOff] [Check] BaseStationToRemote [BabyAlarm, Ok] Remote Unit Hardware Interface RemoteUnit [PwrOn, PwrOff, TwoWay,OneWay, StartTalk, StopTalk] [SendSound,ReceiveSound] RemoteUser [Alarm] Name UW Student ID Number (page 5 of 14) 4.2 (13 Marks) UML State Diagram: Base Station Draw a UML state diagram to model the behaviour of the base station process of the baby monitoring software system. Show declarations of any variables in the SDL style. PwrOff Off PwrOn DCL BS Integer; BatteryDead currentTime() > count + 10/ BabyAlarm Baby Monitoring Mode entry/SendSound(BS) entry/count = currentTime() Noise/count=currentTime() Check/Ok Alarm Sounded TwoWay OneWay Walkie-talkie Mode StartTalk receive entry/ReceiveSound(BS) talk entry/SendSound(BS) StopTalk BatteryLow Battery High Battery Low /Beep BatteryReplaced Name UW Student ID Number (page 6 of 14) 4.3 (13 Marks) SDL Process Diagram: Remote Unit Draw an SDL process diagram to model the behaviour of the remote unit process in the baby monitoring software system. You may assume that time in SDL (durations) is measured in seconds. An extra blank page follows if needed. TIMER CheckTimer, WaitForOkTimer; DCL RU Integer; B Power Off * (Power Off) OneWay ReceiveSound(RU) PwrOn PwrOff SET(NOW+10,CheckTimer) ReceiveSound(RU) Power Off SET(NOW+10,CheckTimer) Baby Monitoring Mode Baby Monitoring Mode TwoWay Walkie− Talkie Mode StartTalk CheckTimer BabyAlarm Alarm B Check Wait for PwrOff SET(NOW+5,WaitForOkTimer) SendSound(RU) Wait for Ok Sending Sound StopTalk B Ok SET(NOW+10,CheckTimer) ReceiveSound(RU) Walkie− Talkie Mode Name Baby Monitoring Mode UW Student ID Number WaitForOkTimer Alarm Wait for PwrOff (page 7 of 14) 4.4 (4 Marks) Requirements and Specifications For the baby monitoring software system, state whether each of the following sentences is domain knowledge, part of the specification, or a requirement (using Jackson and Zave’s definitions of these terms). Note: Half of the marks for each question will be deducted for an incorrect answer. 1. If the baby doesn’t cry for 10 seconds, the remote unit will sound an alarm. Requirement 2. Two devices will not both try to talk in walkie-talkie mode at the same time. Domain knowledge 3. When the system goes into the baby monitoring mode, it sends the SendSound signal to the hardware interface. Specification 4. The base station hardware is sensitive enough to detect the sound of a baby’s breath. Domain knowledge Name UW Student ID Number (page 8 of 14) 5 (8 Marks) UML Class Diagram Santa’s making his list and checking it twice. He needs some software to help him out. Draw a class diagram (conceptual model) for the system described below. In your class diagram, show all attributes and operations contained in the description. Show all multiplicities and non-obvious labels on the associations. You do NOT need to show navigability. There is a set of elves who make toys. Every elf can make multiple toys. Every child has a list of up to 3 toys that he or she would like. Every child receives a gift. Depending on whether a child is naughty or nice, his or her gift contains one or two toys. There are three kinds of toys: trains, dolls, and Xboxes. Every toy has a cost to produce the toy. The sum of the costs is Santa’s yearly expenses. requests 1 Children +status 1 Elves receives 1 1 0..3 makes * sum costs Toys 1..2 1 Gifts +cost Yearly Expenses Trains Name Dolls UW Student ID Number Xboxes (page 9 of 14) 6 (10 Marks) Algebraic Specification 1. (9 marks) Write an algebraic datatype specification in SDL for a simple calendar datatype. The calendar stores appointments, which are (event,day) pairs to indicate that a certain event occurs on a certain day. Only one event can occur on a day in the calendar. The datatype has the following operations: • AddApt: given an event and a day, adds the appointment to the calendar if that day does not already have an event in the calendar; otherwise do not change the calendar. • DeleteApt: given a day, removes from the calendar any event associated with that day. It makes no change to the calendar if no event is scheduled for that day. • LookupDay: returns the event associated with a particular day. It should not be used if there is no event on that day in the calendar. • Busy: returns true if there is an appointment in the calendar on the day passed as an argument. It returns false otherwise. • CountApts: returns how many appointments are in the calendar. You may assume the types Event and Day exist. There is more room on the following page if you need extra space. (Note: part 2 of this question is on the next page.) NEWTYPE Calendar LITERALS EmptyCalendar; OPERATORS AddApt: Event, Day, Calendar -> Calendar; DeleteApt: Day, Calendar -> Calendar; LookupDay: Day, Calendar -> Event; Busy: Day, Calendar -> Boolean; Count: Calendar -> Integer; AXIOMS FOR ALL d,d1,d2 in Day ( FOR ALL e in Event ( FOR ALL c in Calendar ( DeleteApt(d,EmptyCalendar) == EmptyCalendar; DeleteApt(d1,AddApt(e,d2,c)) == if (d1=d2) then AddApt(e,d2,c) else DeleteApt(d1,c); Name UW Student ID Number (page 10 of 14) LookupDay(e,EmptyCalendar) == Error!; LookupDay(d1,AddApt(e,d2,c)) == if (d1=d2) then e else LookupDay(d1,c); Busy(d,EmptyCalendar) == false; Busy(d1,AddApt(e,d2,c)) == (d1=d2) OR Busy(d1,c); CountApts(EmptyCalendar) == 0; CountApts(AddApt(e,d,c)) = 1 + Count(c); Busy(d,c) ==> AddApt(e,d,c) == c; ))); ENDNEWTYPE Calendar; 2. (1 mark) What is the canonical term in your datatype equivalent to completing the following operations in this order: (a) add the appointment (Soccer,Thurs) (b) add the appointment (Baseball,Fri) (c) add the appointment (Movie,Thurs) (d) delete the appointment on Thurs AddApt(Baseball,Fri,EmptyCalendar) Name UW Student ID Number (page 11 of 14) 7 (8 Marks) Temporal Logic and Explicit Time Formalization 7.1 (5 Marks) Temporal Logic Formalization Using the following predicates: • awake(x) means baby x is awake • smile(x) means baby x is smiling formalize the following sentences in temporal logic. Show the types of any quantified variables. 1. Every baby smiles until he or she is awake. ∀x : Baby • smile(x) U awake(x) 2. For all babies, it’s always the case that eventually he or she will smile when he or she wakes up. ∀x : Baby • ¤(♦(¬awake(x) ∧ °(awake(x) ∧ smiles(x)))) 7.2 (3 Marks) Explicit Time Formalization Using the same predicates as for part 1 of this question, formalize the following sentence using explicit time. Show the types of any quantified variables. (You may change the types of the predicates if necessary.) 1. Within every 10 second time period, some baby smiles. ∀t • ∃t1 • t − 5 ≤ t1 ≤ t + 5 ∧ ∃x : Baby • smiles(x, t1 ) Name UW Student ID Number (page 12 of 14) 8 (7 Marks) Validation Circle “true” or “false” to say whether the following temporal formulae are true in the system described by this UML state diagram. Being in a state is described by a proposition letter of the name of the state (e.g., proposition A means the system is in state A). If the formula is not true, provide a counterexample in the form of a sequence of states and events. If multiple propositions are true in a single step in your counterexample, place them within set brackets (e.g., the form of a counterexample is {A, J, e}, {A, G, e, f }, etc., which indicates that propositions A and J and e are all true in the first step). If there is a repeated sequence of steps in the counterexample, repeat it once and then use “. . . ”. Note: Half of the marks for each question will be deducted for an incorrect answer. s x A B u m n C p r H G D E y J q 1. ¤(G ∨ E ∨ J) true 2. ¤((G ∧ y) ⇒ °(A ∧ E)) false Counterexample: {A, E, r}, {A, J, x}, {G, y}, {A, J} 3. ¤(E ∧ x ∧ (♦y) ⇒ (♦E)) true 4. (A ∨ B) U (m ∨ x ∨ n) false Counterexample: {E, A}, {E, A}, . . . 5. ¤(J W q) false Counterexample: {E, A}, {E, A} . . . Name UW Student ID Number (page 13 of 14) 9 (8 Marks) Software Cost Estimation Describe the steps of the software cost estimation process that uses COCOMO to estimate effort and development time based on the requirements. Include any needed formulae. Include the units of measurement used. You do not need to include values for coefficients used in the formulae. Input: Requirements 1. Calculate {Pi } where Pi is the number of instances of the ith function type in the requirements. 2. Determine the function points for the project from the inputs. F P = a 1 P1 + a2 P2 + . . . a n Pn where Pi are the number of instances of the ith function type, and ai is the weighting associated with the ithe function type. 3. Determine KLOC in the implementation language based on the function points and the KLOC/FP for each implementation language. 4. Calculate the effort and development time using the following formulae: E = a × KLOC b × X (unit is person-months) D = c × E d (unit is months) Choose the coefficients a, b, c, and d based on whether the project is organic, semidetached or embedded. X is multipliers for project attributes. Name UW Student ID Number (page 14 of 14)
© Copyright 2024