SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
________________________________ _________________________________ _________________________________
NAME ID SIGNATURE
Department of Electrical and Computer Engineering, McGill University
ECSE 321 - Introduction to Software Engineering
Midterm Examination
October 30, 2003, 11:35am-12:50pm
Prof. Radu Negulescu
INSTRUCTIONS
• Do NOT open this booklet until the start and end times of the examination are written on the board
• Write your name, McGill student ID number, and signature on the cover of the answer booklet and at the
top of this page. Both booklets need to be handed in to the proctor at the end of the examination
• This examination is closed book, closed notes. No aids permitted
• Circle one answer only for each multiple-choice question in this examination booklet. Multiple-choice
questions are equally weighted. Each question has only one correct answer, which gets 2 marks. Wrong
answers get 0 marks or 1 mark (partial credit). No answers or multiple answers in a question get 0 marks
for that question
• Write your answers to the essay-type questions in the separate answer booklet provided. Draw a diagonal
line over each scratch sheet in the answer booklet; scratch sheets will not be marked
• This examination has 75 minutes only
Good luck!
Page 2
SECTION I – MULTIPLE-CHOICE QUESTIONS
CIRCLE ONE ANSWER ONLY IN EACH QUESTION
Question 1. Which of the following coding conventions, principles or guidelines will NOT help in the
development or maintenance of Java code?
(a) Lines of code that are logically related should be placed near one another (principle of proximity)
(b) Each method of a class should have comments that clearly explain the relationships to every other method
of that class (one comment for every pair of methods in the class)
(c) Code layout should highlight the logical structure of the code (fundamental principle of code layout)
(d) Four spaces should be used as the unit of indentation (Java coding convention)
(e) Names should be problem-oriented
Answer: (b). Commenting pairs of methods is clearly excessive and it would create massive redundancies by
restating the preconditions of one method in all the callers. The other guidelines are used standard practice.
Question 2. Waived. (All examinees receive 2 marks.)
Question 3. Which of the following statements is true for flat statechart representations of typical software
systems? (By “flat statechart” we mean a statechart that does not use nesting or concurrency.)
(a) The number of states grows exponentially with the number of components in the system
(b) Each state explodes into several outgoing transitions
(c) A single transition might lead to several different states
(d) Large flat statecharts need to have more than one initial state
(e) None of the above
Answer: (a). It reflects an important phenomenon that limits what can be practically specified, by “flat” state
machines or other means. You have experienced some mild state explosion in Assignment 2 Question 1 (b).
Question 4. Which of the following requirements is most likely to occur in a properly stated SRS? (Assume the
SRS is “complete”, i.e., none of the requirements below needs to be “complete” all by itself.)
(a) “The system shall have a professional-looking user interface.”
(b) “Each button in the Formatting toolbar shall have a tooltip.”
(c) “The average time for refreshing the display shall be 4 seconds or less.”
(d) “The maximum time for registering a key press into memory shall be 0.1 seconds or less.”
(e) “The minimum time for refreshing the display shall be 0 seconds, if possible.”
Answer: (b). It meets all the criteria of good requirements, and it is particularly good because it specifies a UI
feature (“tooltips”) decoupled from the functionality features in the “Formatting toolbar” (regardless of the
number of buttons). Option (c) looks good but it is somewhat ambiguous, since it might be interpreted as a
“raster refresh rate” assumption rather than the “repainting graphical elements” obligation. It is important to
avoid multiple “standard” interpretations even if some of them don’t make much sense from a technical
viewpoint.
Question 5. Waived. (All examinees receive 2 marks.)
Page 3
Source
register (Listener)
unregister (Listener)
cast (Event)
Listener
handle (Event)
*1
ConcreteListener
listenerState
handle (Event)
ConcreteSource
subjectState
cast (Event)
* 1
OLVWHQHU6WDWH HYHQWJHW6WDWH
Event
copyState
getState ()
*1
FUHDWH QHZ (YHQW H
IRU HDFK UHJLVWHUHG /LVWHQHU O
OKDQGOHH
event
(YHQW VRXUFH (YHQW OLVWHQHUV
Question 6. Consider the class diagram above, representing a basic event broadcast mechanism. Which of the
following statements is NOT true for this diagram?
(a) ConcreteSource objects can create new Event objects
(b) Listener objects can be added and removed at run time from a list maintained by a Source object
(c) The cast(Event) method of a ConcreteSource object calls the handle(Event) method of each registered
Listener object
(d) ConcreteListener objects update the copyState fields of the Event objects
(e) Each Listener object can be registered with only one Source object
Answer: (d), because in this diagram event objects cannot be updated. Although in some frameworks we could
have listeners registered with multiple sources, Option (e) is not quite right in this diagram because the Source-
Listener association has multiplicity 1-*. This diagram is consistent with the basic (unsophisticated)
implementations of event passing mechanisms.
Question 7. Consider the software driver for a web camera, which captures the video image in real time and
makes it available over the Internet. Which of the following can NOT be an actor for the software driver?
(a) The Internet connection of the local computer
(b) The port used by the video camera
(c) The user
(d) Arnold Schwarzenegger
(e) All of the above are good actors for the web camera software driver
(Hint: do not confuse good actors with actor instances.)
Answer: (d). Arnie is not an actor because the software doesn’t need to be “aware” of him! Even if Arnie were to
purchase the software and use it as a user, Arnie can be at most an actor instance, but not an actor.
Page 4
Question 8. The guideline of 7 +/– 2 submodules per level is considered optimal for the following reason:
(a) It reduces the memory requirements of the program
(b) It matches approximately the number of distinct concepts that can be handled simultaneously by an
average developer
(c) It increases the speed of the program
(d) It appeals to the subjective taste of the average developers
(e) None of the above
Answer: (b). Psychological/cognitive considerations are the basis for many guidelines for improving productivity
in software engineering. This particular guideline has nothing to do with program performance or memory
requirements, and there is nothing subjective about it.
Controller
Model
subscriber
notifier
initiator
*
repository1
1
*
View
Question 9. Which of the following can be a sequence of events involved in the MVC architecture, according to
the class diagram above:
(a) A Model object sends an event to a View object, which notifies a Controller object
(b) A View object sends an event to a Model object, which notifies a Controller object
(c) A Controller object sends an event to a Model object, which notifies several View objects
(d) All of the above
(e) None of the above
Answer: (c). This is the only one consistent with the associations in the diagram and the basic MVC architecture.
In some variations of MVC, controllers might “talk to” views, but, even there, views do not “talk back” to
controllers.
The following two questions refer to the following insertion sort routine. (Array indices start at 1.)
routine insertionSort (A)
for j = 2 to length of array A
// INV: ...
key = A[j]
i = j – 1
while i  0 and A[i]  key do
A[i + 1] = A[i]
i = i – 1
end while
A[i + 1] = key
end for
Page 5
Question 10. Assume the insertionSort routine is used internally by a program. Which of the following
pre- and post-condition pairs is the most appropriate for insertionSort from a maintainability viewpoint?
(a) Pre: none; post: array is sorted
(b) Pre: array is not sorted; post: array is sorted
(c) Pre: array has at least one element; post: array is sorted
(d) Pre: array has at least two elements; post: array is sorted
(e) Pre: array reference is non-null; post: array is sorted
Answer: (e). As per tutorial, array references can (and should) be constrained by assertions. Option (a) is a close
call but Option (e) is more appropriate.
Question 11. Which of the following assertions is valid each time the program reaches the line “INV”?
(a) Items 1 through j are sorted
(b) Items 1 through j – 1 are sorted
(c) key equals A[j]
(d) i equals 0
(e) j equals 1
Answer: (b). All other options can be invalidated at some iteration of the loop.
Question 12. Keeping CRC cards to the size of 4x6 inches is considered important because:
(a) Software engineers prefer even numbers and inch measurement units
(b) This size allows just enough space to describe a class of optimal complexity in large script
(c) This size is conducive to optimal performance in implementing an object-oriented program
(d) All of the above
(e) None of the reasons above
Answer: (b). For this reason, some software developers actually feel very strongly about 4”X6” CRC cards.
Options (a) and (c) are ludicrous.
Question 13. Which of the following applies to the statement “If class X uses defensive programming in each
method, then good programming practice recommends that any subclass Y that inherits from X should also use
defensive programming in each method”
(a) Always true
(b) Always false
(c) It depends on whether or not the subclass is used at the boundary of the system
(d) It depends on whether the class invariant of Y is stronger than that of X or the same
(e) None of the above
Answer: (d). Option (a) is close but not quite right. If class X uses defensive programming in method M then
method M accepts any values for the parameters and the class fields. The Liskov Substitution Principle (LSP)
requires that class Y has method M that can also take any values for the parameters. However, the invariant of
class Y could be stronger, in which case method M can make certain assumptions regarding the values of the
Page 6
class fields, without violating the LSP as long as proper encapsulation avoids direct access to the object’s fields.
The LSP is an excellent rule of thumb for using inheritance.
Question 14. You are developing a command-line user interface. Which of the following design patterns is the
most likely to make it easy to add new commands in later versions of the program?
(a) Command
(b) Composite
(c) Observer
(d) Strategy
(e) Proxy
Answer: (a). The Command pattern is used specifically for the purpose of making it easy to add new commands.
Question 15. Which of the following checks is LEAST likely to detect maintainability problems in an object-
oriented design?
(a) Tracing in the class diagram one scenario for each use case
(b) Tracing each design element to a functional requirement
(c) Checking that none of the design elements can be removed
(d) Checking for naming conflicts
(e) Using calibrated stubs to predict performance
Answer: (e). Calibrated stubs will detect performance problems but not maintainability problems. Tracing
scenarios in the class diagrams and checking for naming conflicts will detect inconsistencies; tracing design
elements and checking for removable design elements will detect redundancies. Inconsistency and redundancy
lead to poor maintainability.
Page 7
SECTION II – ESSAY-TYPE QUESTIONS
WRITE YOUR ANSWERS IN THE ANSWER BOOKLET
Question 16. (Requirements, analysis)
You are developing ThumbsUp, a browser for the newest WebBerry, a popular wireless device that has a color
display and a mouse wheel, but no keyboard and no mouse. ThumbsUp has the following buttons only: “Back”,
“Forward”, “Page”, and “Exit”, in this sequence. Initially, ThumbsUp is in the “buttons” mode of operation, where
moving the wheel cycles through the buttons in the sequence above, and clicking the wheel activates the selected
button. As usual, buttons “Back” and “Forward” move back and forward through a list of recently visited web
pages, and button “Exit” exits the browser. Button “Page” makes the browser go into the “page” mode of
operation where moving the wheel cycles through the hyperlinks on the currently displayed web page and double-
clicking the wheel activates the selected hyperlink and loads and displays a new web page. Triple-clicking the
wheel goes back to the “buttons” mode. The default selections on entry to the “buttons” and “page” modes are the
“Back” button and the first hyperlink of the current page, respectively. The screen scrolls automatically in the
“page” mode to keep the current link within the viewable area. Each time ThumbsUp starts, it displays the home
page of WebBerryWorld.com, which has hyperlinks to several major web directories.
(a) Draw a use case diagram for ThumbsUp. Be sure to cover both stated and implied requirements and give
self-explaining names to the diagram elements. [10]
User
HttpServer
PageRestore
Back
LoadPage
Forward
LoadStartPage
Exit
ButtonsMode
include
include
PageMode
include
include
(b) Draw a sequence diagram for a scenario to visit 3 web pages (including the home page), then go back 1
web page, then go forward 1 web page to the last page visited. [10]

Más contenido relacionado

La actualidad más candente

Requirement verification & validation
Requirement verification & validationRequirement verification & validation
Requirement verification & validation
Abdul Basit
 

La actualidad más candente (20)

GameDay - Achieving resilience through Chaos Engineering
GameDay - Achieving resilience through Chaos EngineeringGameDay - Achieving resilience through Chaos Engineering
GameDay - Achieving resilience through Chaos Engineering
 
Kiviat diagrams & Goal Structuring Notation
Kiviat diagrams & Goal Structuring NotationKiviat diagrams & Goal Structuring Notation
Kiviat diagrams & Goal Structuring Notation
 
System Quality Attributes for Software Architecture
System Quality Attributes for Software ArchitectureSystem Quality Attributes for Software Architecture
System Quality Attributes for Software Architecture
 
Case Study Research in Software Engineering
Case Study Research in Software EngineeringCase Study Research in Software Engineering
Case Study Research in Software Engineering
 
Building an Activity Feed with Cassandra
Building an Activity Feed with CassandraBuilding an Activity Feed with Cassandra
Building an Activity Feed with Cassandra
 
Vaccine Stock Management Tool - System documentation
Vaccine Stock Management Tool - System documentationVaccine Stock Management Tool - System documentation
Vaccine Stock Management Tool - System documentation
 
Cocomo model
Cocomo modelCocomo model
Cocomo model
 
Model Based Software Architectures
Model Based Software ArchitecturesModel Based Software Architectures
Model Based Software Architectures
 
Chapter 2 software development life cycle models
Chapter 2 software development life cycle modelsChapter 2 software development life cycle models
Chapter 2 software development life cycle models
 
Lecture 12 requirements modeling - (system analysis)
Lecture 12   requirements modeling - (system analysis)Lecture 12   requirements modeling - (system analysis)
Lecture 12 requirements modeling - (system analysis)
 
The History of DevOps (and what you need to do about it)
The History of DevOps (and what you need to do about it)The History of DevOps (and what you need to do about it)
The History of DevOps (and what you need to do about it)
 
Advanced Software Engineering.ppt
Advanced Software Engineering.pptAdvanced Software Engineering.ppt
Advanced Software Engineering.ppt
 
Software Project Management (monitoring and control)
Software Project Management (monitoring and control)Software Project Management (monitoring and control)
Software Project Management (monitoring and control)
 
Requirements engineering for agile methods
Requirements engineering for agile methodsRequirements engineering for agile methods
Requirements engineering for agile methods
 
Software Coding- Software Coding
Software Coding- Software CodingSoftware Coding- Software Coding
Software Coding- Software Coding
 
Basic Software Effort Estimation
Basic Software Effort EstimationBasic Software Effort Estimation
Basic Software Effort Estimation
 
Requirement verification & validation
Requirement verification & validationRequirement verification & validation
Requirement verification & validation
 
Software Development Methodologies.pptx
Software Development Methodologies.pptxSoftware Development Methodologies.pptx
Software Development Methodologies.pptx
 
Software metrics
Software metricsSoftware metrics
Software metrics
 
Software Generic Design Process.
Software Generic Design Process.Software Generic Design Process.
Software Generic Design Process.
 

Destacado

Science midterm exam (10)
Science midterm exam (10)Science midterm exam (10)
Science midterm exam (10)
ariyacca
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
Kinshook Chaturvedi
 
Critical System Specification in Software Engineering SE17
Critical System Specification in Software Engineering SE17Critical System Specification in Software Engineering SE17
Critical System Specification in Software Engineering SE17
koolkampus
 
Yazilim mi̇mari̇leri̇(aoy)
Yazilim mi̇mari̇leri̇(aoy)Yazilim mi̇mari̇leri̇(aoy)
Yazilim mi̇mari̇leri̇(aoy)
Ahmet Yanik
 
Enterprise Systems: SCM, CRM, & ERP
Enterprise Systems: SCM, CRM, & ERPEnterprise Systems: SCM, CRM, & ERP
Enterprise Systems: SCM, CRM, & ERP
UMaine
 

Destacado (18)

Science midterm exam (10)
Science midterm exam (10)Science midterm exam (10)
Science midterm exam (10)
 
Gereksinimleri Meydana Çıkarma Teknikleri
Gereksinimleri Meydana Çıkarma Teknikleri Gereksinimleri Meydana Çıkarma Teknikleri
Gereksinimleri Meydana Çıkarma Teknikleri
 
TALAT Lecture 3300: Fundamentals of Metal Forming
TALAT Lecture 3300: Fundamentals of Metal FormingTALAT Lecture 3300: Fundamentals of Metal Forming
TALAT Lecture 3300: Fundamentals of Metal Forming
 
Kssr English Yr 4 Mid term exam
Kssr  English Yr 4 Mid term examKssr  English Yr 4 Mid term exam
Kssr English Yr 4 Mid term exam
 
I p-o in different data processing systems
I p-o in different data processing systemsI p-o in different data processing systems
I p-o in different data processing systems
 
Critical System Specification in Software Engineering SE17
Critical System Specification in Software Engineering SE17Critical System Specification in Software Engineering SE17
Critical System Specification in Software Engineering SE17
 
Yazilim mi̇mari̇leri̇(aoy)
Yazilim mi̇mari̇leri̇(aoy)Yazilim mi̇mari̇leri̇(aoy)
Yazilim mi̇mari̇leri̇(aoy)
 
Ian Sommerville, Software Engineering, 9th Edition Ch1
Ian Sommerville,  Software Engineering, 9th Edition Ch1Ian Sommerville,  Software Engineering, 9th Edition Ch1
Ian Sommerville, Software Engineering, 9th Edition Ch1
 
Mid term examination -2011 class vi
Mid term examination -2011 class viMid term examination -2011 class vi
Mid term examination -2011 class vi
 
U4 p0 overview of metal forming
U4 p0 overview of metal formingU4 p0 overview of metal forming
U4 p0 overview of metal forming
 
Topic 4 metal forming 160214
Topic 4 metal forming 160214Topic 4 metal forming 160214
Topic 4 metal forming 160214
 
Ian Sommerville, Software Engineering, 9th Edition Ch 4
Ian Sommerville,  Software Engineering, 9th Edition Ch 4Ian Sommerville,  Software Engineering, 9th Edition Ch 4
Ian Sommerville, Software Engineering, 9th Edition Ch 4
 
Ch2 sw processes
Ch2 sw processesCh2 sw processes
Ch2 sw processes
 
Semiotics
SemioticsSemiotics
Semiotics
 
Metal forming processes
Metal forming processesMetal forming processes
Metal forming processes
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Requirement elicitation
Requirement elicitationRequirement elicitation
Requirement elicitation
 
Enterprise Systems: SCM, CRM, & ERP
Enterprise Systems: SCM, CRM, & ERPEnterprise Systems: SCM, CRM, & ERP
Enterprise Systems: SCM, CRM, & ERP
 

Similar a Midterm Exam Solutions Fall03

Final Exam Questions Fall03
Final Exam Questions Fall03Final Exam Questions Fall03
Final Exam Questions Fall03
Radu_Negulescu
 
Final Exam Solutions Fall02
Final Exam Solutions Fall02Final Exam Solutions Fall02
Final Exam Solutions Fall02
Radu_Negulescu
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
rosemarybdodson23141
 
Session 3 Software Engineering UGC NET.pdf
Session 3 Software Engineering UGC NET.pdfSession 3 Software Engineering UGC NET.pdf
Session 3 Software Engineering UGC NET.pdf
sangeethachandran
 
Primilimnary round questions with answers
Primilimnary round questions with answersPrimilimnary round questions with answers
Primilimnary round questions with answers
Dr. C.V. Suresh Babu
 
Specialist marketing officer professional knowledge questions.pdf(1)
Specialist marketing officer professional knowledge questions.pdf(1)Specialist marketing officer professional knowledge questions.pdf(1)
Specialist marketing officer professional knowledge questions.pdf(1)
Nivi Mohanty
 
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdf
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdfSubject name Object Oriented Analysis and DesignMultiple Choice (.pdf
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdf
akilastationarrymdu
 

Similar a Midterm Exam Solutions Fall03 (20)

Final Exam Questions Fall03
Final Exam Questions Fall03Final Exam Questions Fall03
Final Exam Questions Fall03
 
Final Exam Solutions Fall02
Final Exam Solutions Fall02Final Exam Solutions Fall02
Final Exam Solutions Fall02
 
BDS_QA.pdf
BDS_QA.pdfBDS_QA.pdf
BDS_QA.pdf
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
 
Higher Homework
Higher HomeworkHigher Homework
Higher Homework
 
midterm_fa07.pdf
midterm_fa07.pdfmidterm_fa07.pdf
midterm_fa07.pdf
 
Session 3 Software Engineering UGC NET.pdf
Session 3 Software Engineering UGC NET.pdfSession 3 Software Engineering UGC NET.pdf
Session 3 Software Engineering UGC NET.pdf
 
Semester ii
Semester   iiSemester   ii
Semester ii
 
Primilimnary round questions with answers
Primilimnary round questions with answersPrimilimnary round questions with answers
Primilimnary round questions with answers
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineers
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineers
 
Gate-Cs 1994
Gate-Cs 1994Gate-Cs 1994
Gate-Cs 1994
 
Specialist marketing officer professional knowledge questions.pdf(1)
Specialist marketing officer professional knowledge questions.pdf(1)Specialist marketing officer professional knowledge questions.pdf(1)
Specialist marketing officer professional knowledge questions.pdf(1)
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Gate-Cs 1992
Gate-Cs 1992Gate-Cs 1992
Gate-Cs 1992
 
final_2014.pdf
final_2014.pdffinal_2014.pdf
final_2014.pdf
 
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdf
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdfSubject name Object Oriented Analysis and DesignMultiple Choice (.pdf
Subject name Object Oriented Analysis and DesignMultiple Choice (.pdf
 
PGCET Computer science 2017 question paper
PGCET Computer science 2017 question paperPGCET Computer science 2017 question paper
PGCET Computer science 2017 question paper
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 

Más de Radu_Negulescu

Intro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality AssuranceIntro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality Assurance
Radu_Negulescu
 
Midterm Exam Solutions Fall02
Midterm Exam Solutions Fall02Midterm Exam Solutions Fall02
Midterm Exam Solutions Fall02
Radu_Negulescu
 
Intro to Software Engineering - Life Cycle Models
Intro to Software Engineering - Life Cycle ModelsIntro to Software Engineering - Life Cycle Models
Intro to Software Engineering - Life Cycle Models
Radu_Negulescu
 
Intro to Software Engineering - Software Testing
Intro to Software Engineering - Software TestingIntro to Software Engineering - Software Testing
Intro to Software Engineering - Software Testing
Radu_Negulescu
 
Intro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality AssuranceIntro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality Assurance
Radu_Negulescu
 
Intro to Software Engineering - Software Design
Intro to Software Engineering - Software DesignIntro to Software Engineering - Software Design
Intro to Software Engineering - Software Design
Radu_Negulescu
 
Intro to Software Engineering - Module Design
Intro to Software Engineering - Module DesignIntro to Software Engineering - Module Design
Intro to Software Engineering - Module Design
Radu_Negulescu
 
Intro to Software Engineering - Requirements Analysis
Intro to Software Engineering - Requirements AnalysisIntro to Software Engineering - Requirements Analysis
Intro to Software Engineering - Requirements Analysis
Radu_Negulescu
 
Intro to Software Engineering - Coding Standards
Intro to Software Engineering - Coding StandardsIntro to Software Engineering - Coding Standards
Intro to Software Engineering - Coding Standards
Radu_Negulescu
 
Software Engineering Practice - Software Quality Management
Software Engineering Practice - Software Quality ManagementSoftware Engineering Practice - Software Quality Management
Software Engineering Practice - Software Quality Management
Radu_Negulescu
 
Software Engineering Practice - Software Metrics and Estimation
Software Engineering Practice - Software Metrics and EstimationSoftware Engineering Practice - Software Metrics and Estimation
Software Engineering Practice - Software Metrics and Estimation
Radu_Negulescu
 
Software Engineering Practice - Software Business Basics
Software Engineering Practice - Software Business BasicsSoftware Engineering Practice - Software Business Basics
Software Engineering Practice - Software Business Basics
Radu_Negulescu
 
Software Engineering Practice - Project management
Software Engineering Practice - Project managementSoftware Engineering Practice - Project management
Software Engineering Practice - Project management
Radu_Negulescu
 
Software Engineering Practice - Configuration management
Software Engineering Practice - Configuration managementSoftware Engineering Practice - Configuration management
Software Engineering Practice - Configuration management
Radu_Negulescu
 
Software Engineering Practice - Advanced Development Methodologies
Software Engineering Practice - Advanced Development MethodologiesSoftware Engineering Practice - Advanced Development Methodologies
Software Engineering Practice - Advanced Development Methodologies
Radu_Negulescu
 

Más de Radu_Negulescu (15)

Intro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality AssuranceIntro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality Assurance
 
Midterm Exam Solutions Fall02
Midterm Exam Solutions Fall02Midterm Exam Solutions Fall02
Midterm Exam Solutions Fall02
 
Intro to Software Engineering - Life Cycle Models
Intro to Software Engineering - Life Cycle ModelsIntro to Software Engineering - Life Cycle Models
Intro to Software Engineering - Life Cycle Models
 
Intro to Software Engineering - Software Testing
Intro to Software Engineering - Software TestingIntro to Software Engineering - Software Testing
Intro to Software Engineering - Software Testing
 
Intro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality AssuranceIntro to Software Engineering - Software Quality Assurance
Intro to Software Engineering - Software Quality Assurance
 
Intro to Software Engineering - Software Design
Intro to Software Engineering - Software DesignIntro to Software Engineering - Software Design
Intro to Software Engineering - Software Design
 
Intro to Software Engineering - Module Design
Intro to Software Engineering - Module DesignIntro to Software Engineering - Module Design
Intro to Software Engineering - Module Design
 
Intro to Software Engineering - Requirements Analysis
Intro to Software Engineering - Requirements AnalysisIntro to Software Engineering - Requirements Analysis
Intro to Software Engineering - Requirements Analysis
 
Intro to Software Engineering - Coding Standards
Intro to Software Engineering - Coding StandardsIntro to Software Engineering - Coding Standards
Intro to Software Engineering - Coding Standards
 
Software Engineering Practice - Software Quality Management
Software Engineering Practice - Software Quality ManagementSoftware Engineering Practice - Software Quality Management
Software Engineering Practice - Software Quality Management
 
Software Engineering Practice - Software Metrics and Estimation
Software Engineering Practice - Software Metrics and EstimationSoftware Engineering Practice - Software Metrics and Estimation
Software Engineering Practice - Software Metrics and Estimation
 
Software Engineering Practice - Software Business Basics
Software Engineering Practice - Software Business BasicsSoftware Engineering Practice - Software Business Basics
Software Engineering Practice - Software Business Basics
 
Software Engineering Practice - Project management
Software Engineering Practice - Project managementSoftware Engineering Practice - Project management
Software Engineering Practice - Project management
 
Software Engineering Practice - Configuration management
Software Engineering Practice - Configuration managementSoftware Engineering Practice - Configuration management
Software Engineering Practice - Configuration management
 
Software Engineering Practice - Advanced Development Methodologies
Software Engineering Practice - Advanced Development MethodologiesSoftware Engineering Practice - Advanced Development Methodologies
Software Engineering Practice - Advanced Development Methodologies
 

Último

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Midterm Exam Solutions Fall03

  • 1. ________________________________ _________________________________ _________________________________ NAME ID SIGNATURE Department of Electrical and Computer Engineering, McGill University ECSE 321 - Introduction to Software Engineering Midterm Examination October 30, 2003, 11:35am-12:50pm Prof. Radu Negulescu INSTRUCTIONS • Do NOT open this booklet until the start and end times of the examination are written on the board • Write your name, McGill student ID number, and signature on the cover of the answer booklet and at the top of this page. Both booklets need to be handed in to the proctor at the end of the examination • This examination is closed book, closed notes. No aids permitted • Circle one answer only for each multiple-choice question in this examination booklet. Multiple-choice questions are equally weighted. Each question has only one correct answer, which gets 2 marks. Wrong answers get 0 marks or 1 mark (partial credit). No answers or multiple answers in a question get 0 marks for that question • Write your answers to the essay-type questions in the separate answer booklet provided. Draw a diagonal line over each scratch sheet in the answer booklet; scratch sheets will not be marked • This examination has 75 minutes only Good luck!
  • 2. Page 2 SECTION I – MULTIPLE-CHOICE QUESTIONS CIRCLE ONE ANSWER ONLY IN EACH QUESTION Question 1. Which of the following coding conventions, principles or guidelines will NOT help in the development or maintenance of Java code? (a) Lines of code that are logically related should be placed near one another (principle of proximity) (b) Each method of a class should have comments that clearly explain the relationships to every other method of that class (one comment for every pair of methods in the class) (c) Code layout should highlight the logical structure of the code (fundamental principle of code layout) (d) Four spaces should be used as the unit of indentation (Java coding convention) (e) Names should be problem-oriented Answer: (b). Commenting pairs of methods is clearly excessive and it would create massive redundancies by restating the preconditions of one method in all the callers. The other guidelines are used standard practice. Question 2. Waived. (All examinees receive 2 marks.) Question 3. Which of the following statements is true for flat statechart representations of typical software systems? (By “flat statechart” we mean a statechart that does not use nesting or concurrency.) (a) The number of states grows exponentially with the number of components in the system (b) Each state explodes into several outgoing transitions (c) A single transition might lead to several different states (d) Large flat statecharts need to have more than one initial state (e) None of the above Answer: (a). It reflects an important phenomenon that limits what can be practically specified, by “flat” state machines or other means. You have experienced some mild state explosion in Assignment 2 Question 1 (b). Question 4. Which of the following requirements is most likely to occur in a properly stated SRS? (Assume the SRS is “complete”, i.e., none of the requirements below needs to be “complete” all by itself.) (a) “The system shall have a professional-looking user interface.” (b) “Each button in the Formatting toolbar shall have a tooltip.” (c) “The average time for refreshing the display shall be 4 seconds or less.” (d) “The maximum time for registering a key press into memory shall be 0.1 seconds or less.” (e) “The minimum time for refreshing the display shall be 0 seconds, if possible.” Answer: (b). It meets all the criteria of good requirements, and it is particularly good because it specifies a UI feature (“tooltips”) decoupled from the functionality features in the “Formatting toolbar” (regardless of the number of buttons). Option (c) looks good but it is somewhat ambiguous, since it might be interpreted as a “raster refresh rate” assumption rather than the “repainting graphical elements” obligation. It is important to avoid multiple “standard” interpretations even if some of them don’t make much sense from a technical viewpoint. Question 5. Waived. (All examinees receive 2 marks.)
  • 3. Page 3 Source register (Listener) unregister (Listener) cast (Event) Listener handle (Event) *1 ConcreteListener listenerState handle (Event) ConcreteSource subjectState cast (Event) * 1 OLVWHQHU6WDWH HYHQWJHW6WDWH
  • 4. Event copyState getState () *1 FUHDWH QHZ (YHQW H IRU HDFK UHJLVWHUHG /LVWHQHU O OKDQGOHH
  • 5. event (YHQW VRXUFH (YHQW OLVWHQHUV Question 6. Consider the class diagram above, representing a basic event broadcast mechanism. Which of the following statements is NOT true for this diagram? (a) ConcreteSource objects can create new Event objects (b) Listener objects can be added and removed at run time from a list maintained by a Source object (c) The cast(Event) method of a ConcreteSource object calls the handle(Event) method of each registered Listener object (d) ConcreteListener objects update the copyState fields of the Event objects (e) Each Listener object can be registered with only one Source object Answer: (d), because in this diagram event objects cannot be updated. Although in some frameworks we could have listeners registered with multiple sources, Option (e) is not quite right in this diagram because the Source- Listener association has multiplicity 1-*. This diagram is consistent with the basic (unsophisticated) implementations of event passing mechanisms. Question 7. Consider the software driver for a web camera, which captures the video image in real time and makes it available over the Internet. Which of the following can NOT be an actor for the software driver? (a) The Internet connection of the local computer (b) The port used by the video camera (c) The user (d) Arnold Schwarzenegger (e) All of the above are good actors for the web camera software driver (Hint: do not confuse good actors with actor instances.) Answer: (d). Arnie is not an actor because the software doesn’t need to be “aware” of him! Even if Arnie were to purchase the software and use it as a user, Arnie can be at most an actor instance, but not an actor.
  • 6. Page 4 Question 8. The guideline of 7 +/– 2 submodules per level is considered optimal for the following reason: (a) It reduces the memory requirements of the program (b) It matches approximately the number of distinct concepts that can be handled simultaneously by an average developer (c) It increases the speed of the program (d) It appeals to the subjective taste of the average developers (e) None of the above Answer: (b). Psychological/cognitive considerations are the basis for many guidelines for improving productivity in software engineering. This particular guideline has nothing to do with program performance or memory requirements, and there is nothing subjective about it. Controller Model subscriber notifier initiator * repository1 1 * View Question 9. Which of the following can be a sequence of events involved in the MVC architecture, according to the class diagram above: (a) A Model object sends an event to a View object, which notifies a Controller object (b) A View object sends an event to a Model object, which notifies a Controller object (c) A Controller object sends an event to a Model object, which notifies several View objects (d) All of the above (e) None of the above Answer: (c). This is the only one consistent with the associations in the diagram and the basic MVC architecture. In some variations of MVC, controllers might “talk to” views, but, even there, views do not “talk back” to controllers. The following two questions refer to the following insertion sort routine. (Array indices start at 1.) routine insertionSort (A) for j = 2 to length of array A // INV: ... key = A[j] i = j – 1 while i 0 and A[i] key do A[i + 1] = A[i] i = i – 1 end while A[i + 1] = key end for
  • 7. Page 5 Question 10. Assume the insertionSort routine is used internally by a program. Which of the following pre- and post-condition pairs is the most appropriate for insertionSort from a maintainability viewpoint? (a) Pre: none; post: array is sorted (b) Pre: array is not sorted; post: array is sorted (c) Pre: array has at least one element; post: array is sorted (d) Pre: array has at least two elements; post: array is sorted (e) Pre: array reference is non-null; post: array is sorted Answer: (e). As per tutorial, array references can (and should) be constrained by assertions. Option (a) is a close call but Option (e) is more appropriate. Question 11. Which of the following assertions is valid each time the program reaches the line “INV”? (a) Items 1 through j are sorted (b) Items 1 through j – 1 are sorted (c) key equals A[j] (d) i equals 0 (e) j equals 1 Answer: (b). All other options can be invalidated at some iteration of the loop. Question 12. Keeping CRC cards to the size of 4x6 inches is considered important because: (a) Software engineers prefer even numbers and inch measurement units (b) This size allows just enough space to describe a class of optimal complexity in large script (c) This size is conducive to optimal performance in implementing an object-oriented program (d) All of the above (e) None of the reasons above Answer: (b). For this reason, some software developers actually feel very strongly about 4”X6” CRC cards. Options (a) and (c) are ludicrous. Question 13. Which of the following applies to the statement “If class X uses defensive programming in each method, then good programming practice recommends that any subclass Y that inherits from X should also use defensive programming in each method” (a) Always true (b) Always false (c) It depends on whether or not the subclass is used at the boundary of the system (d) It depends on whether the class invariant of Y is stronger than that of X or the same (e) None of the above Answer: (d). Option (a) is close but not quite right. If class X uses defensive programming in method M then method M accepts any values for the parameters and the class fields. The Liskov Substitution Principle (LSP) requires that class Y has method M that can also take any values for the parameters. However, the invariant of class Y could be stronger, in which case method M can make certain assumptions regarding the values of the
  • 8. Page 6 class fields, without violating the LSP as long as proper encapsulation avoids direct access to the object’s fields. The LSP is an excellent rule of thumb for using inheritance. Question 14. You are developing a command-line user interface. Which of the following design patterns is the most likely to make it easy to add new commands in later versions of the program? (a) Command (b) Composite (c) Observer (d) Strategy (e) Proxy Answer: (a). The Command pattern is used specifically for the purpose of making it easy to add new commands. Question 15. Which of the following checks is LEAST likely to detect maintainability problems in an object- oriented design? (a) Tracing in the class diagram one scenario for each use case (b) Tracing each design element to a functional requirement (c) Checking that none of the design elements can be removed (d) Checking for naming conflicts (e) Using calibrated stubs to predict performance Answer: (e). Calibrated stubs will detect performance problems but not maintainability problems. Tracing scenarios in the class diagrams and checking for naming conflicts will detect inconsistencies; tracing design elements and checking for removable design elements will detect redundancies. Inconsistency and redundancy lead to poor maintainability.
  • 9. Page 7 SECTION II – ESSAY-TYPE QUESTIONS WRITE YOUR ANSWERS IN THE ANSWER BOOKLET Question 16. (Requirements, analysis) You are developing ThumbsUp, a browser for the newest WebBerry, a popular wireless device that has a color display and a mouse wheel, but no keyboard and no mouse. ThumbsUp has the following buttons only: “Back”, “Forward”, “Page”, and “Exit”, in this sequence. Initially, ThumbsUp is in the “buttons” mode of operation, where moving the wheel cycles through the buttons in the sequence above, and clicking the wheel activates the selected button. As usual, buttons “Back” and “Forward” move back and forward through a list of recently visited web pages, and button “Exit” exits the browser. Button “Page” makes the browser go into the “page” mode of operation where moving the wheel cycles through the hyperlinks on the currently displayed web page and double- clicking the wheel activates the selected hyperlink and loads and displays a new web page. Triple-clicking the wheel goes back to the “buttons” mode. The default selections on entry to the “buttons” and “page” modes are the “Back” button and the first hyperlink of the current page, respectively. The screen scrolls automatically in the “page” mode to keep the current link within the viewable area. Each time ThumbsUp starts, it displays the home page of WebBerryWorld.com, which has hyperlinks to several major web directories. (a) Draw a use case diagram for ThumbsUp. Be sure to cover both stated and implied requirements and give self-explaining names to the diagram elements. [10] User HttpServer PageRestore Back LoadPage Forward LoadStartPage Exit ButtonsMode include include PageMode include include (b) Draw a sequence diagram for a scenario to visit 3 web pages (including the home page), then go back 1 web page, then go forward 1 web page to the last page visited. [10]
  • 10. Page 8 :WheelCtrl :ThumbsUp move :User WebBerryWorld move selectForwardButton getPage loadWebPage selectBackButton selectPageButton pressPageButton click selectHyperlink move activateHyperlink double click getPage HttpServer1 HttpServer2 selectHyperlink move activateHyperlink double click getPage triple click selectBackButton displayPage(page1) move selectForwardButton displayPage(page2) page1 page2 (c) Briefly describe how the requirements above may be changed to make them simpler, easier to implement, and more useful to the user. Keep your description within 1/2 page maximum. Focus on the main functional requirements only; do NOT discuss non-functional requirements, error conditions or secondary flows. Hint: Try to make the user interaction with the browser more uniform. [5] As discussed at the lectures, keeping requirements consistent provides better usability and learning curve for the users AND a simpler system with more general modules and fewer special cases. To avoid inconsistencies between the clicking rules for the buttons and the hyperlinks, hyperlinks should be selected by a single click in the page mode, just like the buttons are selected in the buttons mode. There should be some way of returning to the buttons mode, and the simplest way is by double clicking. (Frequent operations should have simple commands.) Further, for consistency of clicking rules, we can do away with the “Page” button and use a double click to go to the page mode. An option is to keep the “Page” button but also allow switching to the page mode by double click. Another possibility is to have a single loop of buttons and hyperlinks. However, that might make it more difficult to navigate back to the buttons. We can use double clicking instead of triple clicking to go to the Back button from any hyperlink. Question 17. (Design) You are developing WareStar, a software system for tracking warehoused computer subsystems. Subsystems can be assembled on site from parts and from other warehoused subsystems. Subsystems can be removed from WareStar by a user. When the number of subsystems of a certain type falls below a predetermined lower limit, WareStar schedules assembly orders (in-house) or supply orders (to manufacturers) to replenish the inventory up to a predetermined upper limit. (a) Draw a class diagram for a high-level design model for WareStar. Hint: use the Composite pattern. [10]
  • 11. Page 9 recursively remove and order subsystems UI SubSys qty, onOrder, LL, UL addQty removeQty order * Part order CompositeSubSys order * StockCtrl subSys qtyUpdate updateStock checkLowerLimit 1 create OrderCtrl subSys qty issueOrder Order Qty issue SupplyOrder issue AssemblyOrder issue * ManufacturerInfo contactInfo sendOrder create SubSysCatalog newSubSys retrieveSubSys OrderDBAdaptor recordOrder 1 * 1 * 1 * 0..1 1 1 * 1 * 1 1 1 * create issue Inventory ControlBoundary Orders create (b) Draw a statechart representing the lifecycle of a subsystem type maintained by WareStar, to clarify at least the following issues: creation of the type, ordering from the manufacturer, reaching the lower control limit. Make sure this statechart is consistent with the methods in the class diagram in Part (a). [5] Low StocknewSubSys order On Order addQty Full Stock removeQty Check LL [qty=LL] [qtyLL] (c) State any invariants on the data structures involved in Part (a). [5] Invariants: (LL = qty + onOrder = UL) The “manufacturer” is the same for all SupplyOrder-s that are issued by the same SubSys The components of a subsystem are always the same as on creation of that subsystem.