420 likes | 982 Vues
COMP 211: Introduction to Software Engineering Final Exam — Sample Solutions May 29, 2002 3 hours Value : 30% of course mark Note: For most questions, the solutions given here are examples only . In most cases other answers are possible and acceptable.
E N D
COMP 211: Introduction to Software Engineering • Final Exam — Sample Solutions • May 29, 2002 3 hours Value: 30% of course mark • Note: For most questions, the solutions given here are examples only. In most cases other answers are possible and acceptable. • 1. Circle the best/correct answer in each question. Each best/correct answer is worth 1 mark. For each question there is only one best/correct answer.Questions that have more than one answer circled will be ignored! • indicates best/correct answer • (A) The cohesion of a module is a measure of the number of: • a. interconnections with other modules. • b. months needed to develop the module. • c. different inputs the module requires. • d. different things a module has to do. • e. different developers who worked on the module.
(B) Which type of abstraction relates similar classes to each other? • a. classification • b. aggregation • c. generalization • d. association • e. different classes are not related by abstraction • (C) Which of the following is not a way to deal with risks in software development? • a. avoid • b. mitigate • c. confine • d. ignore • e. monitor • (D) "The system should not allow more than 10 students to register for a course" is an example of a • a. functional requirement.. • b. nonfunctional requirement. • c. hidden requirement. • d. use case. • e. user interface requirement.
(E) The purpose of an acceptance test plan is to: • a. document the internal functionality of the system. • b. list the candidate requirements for the system. • c. define the goals of the system. • d. specify the criteria for testing whether the system is finished. • e. define the scope of the system development. • (F) The "literalism" of a metaphor of human-computer interaction refers to: • a. the extent to which the metaphor helps the user understand the system and task models. • b. mapping a user's mental model to the task and system model. • c. how well the presentation language displays the required information. • d. providing processing capabilities not normally available in the physical world. • e. the ability to create a good user interface. • (G) In the Analysis Model, we divide the functionality of a use case into boundary, entity and control classes because: • a. message passing is more easily described using these classes. • b. collaboration diagrams use these classes. • c. users can more easily understand the system requirements. • d. these are the only kinds of classes available to us. • e. we want to isolate certain types of changes to certain classes.
(H) An active class is one: • a. for which a statechart is required. • b. for which an activity diagram is required. • c. that has a complicated flow-of-events. • d. that has its own thread of control. • e. that has to handle many operations. • (I) The source code of a component is required to do which type of testing? • a. regression testing. • b. black box testing • c. scenario testing. • d. acceptance testing. • e. interface testing. • (J) Which of the following is an example of an external attribute of software quality? • a. fan out • b. safety • c. lines of code • d. cyclomatic complexity • e. number of operators
2. Circle the correct answer in each question. Each correct answer is worth 1 mark. Questions that have more than one answer circled will be ignored! indicates correct answer • (A) In software engineering, developing models of a software system can help us to reduce the amount of communication with the users. • a. True. b. False. • (B) Classification abstraction picks out unique properties of objects. • a. True. b. False. • (C) The multiplicity of an association refers to how many different classes are being related. • a. True. b. False. • (D) In the Unified Development Process, a system’s architecture is defined mainly during the Elaboration phase. • a. True. b. False. • (E) An economic feasibility analysis is necessary during requirements capture only if there is time in the schedule. • a. True. b. False. • (F) In a flow of events for a use case, all alternative paths are error or exceptional conditions. • a. True. b. False. • (G) The main purpose of a collaboration diagram is to show how classes are linked together to form a use case. • a. True. b. False. • (H) The people and organizations involved in the development are a major issue to consider in the System Design workflow. • a. True. b. False. • (I) Basis path testing can show the absence of logic errors in a program. • a. True. b. False. • (J) Estimating is improved by good historical data. • a. True. b. False.
3. For each statement, state whether you agree or disagree with it. Also briefly explain, in a few sentences, why you agree or disagree. Each correct answer is worth 4 marks. • (A) The only types of risks that need to be considered in developing an embedded software system are technical risks. • DISAGREE. Non-technical risks such as availability of resources, personnel, etc. also need to be considered during the planning stages of the project. While these risks are not dealt with by the technical people on the development team, they do have to be dealt with by the management people on the development team. Whether the software system is embedded or not is not relevant. • (B) The multiplicity of a class that participates in an association can be 0..0. • DISAGREE. A multiplicity of 0..0 makes no sense since it states that the minimum cardinality of the association is 0 and its maximum cardinality is also 0. In effect, this states that there cannot be a link between the classes that the association relates and, hence, there is no need for the association! • (C) All the ideas gathered from customers, users and developers will form the final requirements for a software system. • DISAGREEAll the ideas gathered from customers, users and developers only form the set of candidate requirements. The candidate requirements have to be evaluated for feasibility and for necessity (versus nice to have). Thus the ideas gathered from users are just a starting point in the requirements capture process; they are not the final requirements.
(D) Collaboration diagrams and activity diagrams can show different views of a use case realization —analysis. • AGREECollaboration diagrams show the objects of a use case and how they interact (how the objects are related) to realize a use case in the analysis model. Activity diagrams can be used to show the workflow (the activities carried out by the objects) required to realize a use case in the analysis model. Collaboration diagrams show the objects of a use case and their relationships to each other. Activity diagrams show the processing carried out by a use case and how the processing flows from activity to activity. These are two different views of a use case realization—analysis. • (E) The purpose of testing is to show that we have built a quality product. • DISAGREE The purpose of testing is to find bugs (i.e., to make the software fail). Testing cannot show the quality of the product since product quality involves more than merely showing that the system works as specified (which is one of the things that testing can show). It also involves showing that the documentation is of a good standard, that the system can be maintained, etc. • (F) All the standards contained in an organization’s Standards Handbook should be followed on every software development project. • DISAGREE The standards contained in an organization’s Standards Handbook define desirable “best practices” for the organization. However, the characteristics of a software development project may dictate that some of these standards either do not apply or are not appropriate to use for this project. Thus, each software development project needs to determine at the start of the project which standards contained in the organization’s Standards Handbook should be: used as is; ignored; modified to fit the characteristics of the project; or whether new standards need to be developed for this project.
4. Consider the description of the seizure management system for the Intellectual Property Investigation Bureau of the Customs and Excise Department given on the Supplementary Sheet for the Final Exam. • (a) List all the classes that are relevant to include in the domain model for the system and their attributes. (Only classes and attributes that are explicitly given in the problem description should be included.) [Note: Marks will be deducted both for missing classes/attributes as well as for including extra classes/ attributes not given in the problem description.] • SeizureCase seizureID, offenseDate, arrestStatus, caseStatus, remarks • MovementRecord place, status, date • ExaminationRecord date, remarks • SortingRecord processingTime, date, remarks • Carton cartonID, quantity, remarks • Location locationID, floor • Staff staffID, name, position, password
* 1 1..* HasCarton Carton SeizureCase * 1 1 1 Hasorting HasMovement LocatedIn HasExamination * * * 1 FromTo * 1 Seizure PIC SortingRecord ExaminationRecord MovementRecord Location * * * ExaminationPIC SortingPIC MovementPIC 1 1 1 Staff 1 • (b) Construct a class diagram showing how the classes identified in (a) are related. You do not need to show the attributes of the classes. For association multiplicity only, make reasonable assumptions where required using the information given in the problem description as well as your knowledge of the real world.
5. Consider the use-case description and domain model, which shows the navigability of the associations, for the video sales and rental shop application given on the Supplementary Sheet for the Final Exam. • Using only one boundary class, one control class and any of the entity classes specified in the domain model, write the flow of events—analysis for this use case and construct a sequence diagram that shows the objects required to realize this use case and the messages that are passed among the objects. State any assumptions that you need to make. • Flow of events for Reserve Video (Staff scenario) Use Case—Analysis • 1. The ReserveVideoUI object displays the screen for reserving a video. • 2. The user enters the member number and the movie ID. • 3. The ReserveVideoUI asks the ReserveVideoMgr to reserve the indicated video. • 4. The ReserveVideoMgr gets the list of rental copies for the movie from the MovieVideo object. • 5. The ReserveVideoMgr searches through the list of rental copies for an available one. • 6. The ReserveVideoMgr asks the available Rental object to reserve itself for the member. • 7. The ReserveVideoMgr informs the Member object of the new reservation. • Notes: • 1. Since we are only given the movieID as an input value, we need to identify the rental copies for a movie via its associated MovieVideo object, which knows about all of its rental copies by way of the association Has between MovieVideo and RentalCopy. • 2. Since not all copies of a video may be available for rental (either rented already or reserved), we need to search for an available copy. Since this is the basic path, we assume that the search succeeds in finding an available copy. • 3. Since the navigability of the Reserves association is bi-directional, it is necessary for the Member object to be informed of the fact that a new video has been reserved.
:ReserveVideoMgr :Member :MovieVideo :RentalCopy :ReserveVideoUI display reserve video screen() select reserve video enter member# enter movieID reserve(member#, movieID) Staff aMovie := find(movieID) copyList := getCopyInfo(aMovie) aCopy := findAvailableCopy() *[until aCopy≠null] aMember := find(member#) reserveCopy(aMember) addReservation(aCopy) 1 2 3 4 5 6 7 8 9 10 11
6. Consider the Reserve Video use case and accompanying domain model given for Question 5 on the Supplementary Sheet for the Final Exam. • (a) How would you determine whether a copy of a movie video can be reserved? • The first important thing to note that the question asks how to determine whether a copy of a movie video can be reserved, not whether a member can reserve a copy of a movie video. • To determine whether a copy of a movie video can be reserved, we need to check two things with respect to the corresponding RentalCopy object: • 1. Is the copy currently reserved (i.e., does the object currently have a Reserves link; if yes, then it cannot be reserved); • 2. Is the copy currently rented (i.e., does the object currently have a valid date due that is greater than today; if yes, then it cannot be reserved). • Note that the link Rents cannot be used to check if a copy is currently rented as this is a many-to-many association that keeps track of all rentals of a copy. • (b) During the design workflow, what could you do and/or change to optimize (i.e., make more efficient) your answer to (a)? • Since it can be quite expensive to check whether links exist and since in some cases both tests need to be done, one simple way to optimize this checking is to add an new attribute status to the RentalCopy class. The value of this attribute can be either: available, rented or reserved. The attribute is set whenever a copy is returned, rented or reserved, respectively. Now all that we need to check is the value of this attribute to determine whether a copy of a movie can be reserved (or rented). • Since we are given only a video ID to find a rental copy, another optimization would be include the attribute videoID in the class Rental copy so that we do not need to follow the links from Movie video to Rental copy when checking whether a copy is available to be reserved.(In fact, if the domain model is stored as a relational database, this would be done anyway to implement the Has association.)
1 2 Region 1 3 Region 2 4 Region 3 5 Region 4 Region 5 6 7 8 Region 6 Region 7 9 • 7. Consider the schedulePresentation procedure shown the Supplementary Sheet for the Final Exam. • (a) Draw the flow graph for the schedulePresentation procedure. • (b) Label the regions of the flow graph. • (c) Show the flow graph node to procedure statement mapping. Flow graph node to program statement mapping: 1. 1, 2 2. 2 3. 3 4. 3 5. 4 6. 4 7. 5, 6 8. 7, 8, 9, 10, 11, 12, 13, 14, 15 9. 16
8. In the schedulePresentation procedure shown on the Supplementary Sheet for the Final Exam, consider the procedure timeValid called from the schedulePresentation procedure, and the input parameter time to this procedure, which is specified in terms of a 24-hour clock. The valid times for scheduling a presentation are from 9:00 a.m. to 12:30 p.m. and from 2:00 p.m. to 5:00 p.m. • Specify and describe the valid and invalid sets of test data needed for testing the timeValid procedure? • There are 2 valid test data sets: • 1. 9:00 a.m. to 12:30 p.m. • 2. 2:00 p.m. to 5:00 p.m. • There are 3 invalid test data sets: • 1. greater than 5:00 p.m. and less than 9:00 a.m. • 2. greater than 12:30 p.m. and less than 2:00 p.m. • 3. any non-valid time (e.g., 25:00)