CS246 Software Abstraction and Specification Final Examination

Size: px
Start display at page:

Download "CS246 Software Abstraction and Specification Final Examination"

Transcription

1 CS246 Software Abstraction and Specification ination Spring 2007 Date: 04-Aug-2007 Time: pm Permitted Aids: None 14 pages Student Name: UW Student ID: Instructions: (Read carefully before the exam begins): 1. Before you begin, make certain that you have one Exam Booklet with pages numbered 1 14 printed double-sided. 2. The marks assigned to each question are shown at the beginning of the question; use this information to organize your time effectively. Question out of mark marker s initials 3. Place all your answers in the spaces provided on these pages. 4. You do not need to write comments in your code unless it is specifically required by the question Questions will not be interpreted. Proctors will only confirm or deny errors in the questions. If you consider the wording of a question to be ambiguous, state your assumptions clearly and proceed to answer the question to the best of your ability. You may not trivialize the problem in your assumptions. 6. Cheating is an academic offense. Your signature on this exam indicates that you understand and agree to the University s policies regarding cheating on exams Total 95

2 Question 1. (10 marks) General Read each of the following statements carefully. For each statement, circle T if the statement is true and circle F if the statement is false. T / F In UML, a subclass inherits all of its parent class's OCL constraints. T / F In C++, if a class has pointer data members, then the class's destructor method should always delete those members' referenced objects. T / F In C++, all calls to virtual methods are resolved, to the specific function called, at runtime. T / F In C++, a const function is a function that does not modify any of its parameter variables. T / F In C++. nonmember functions are defined outside of any class definition. T / F In object-oriented programming, inheritance and object composition both promote code reuse. T / F In object-oriented programming, language constructs such as classes and objects realize designs that have good cohesion and loose coupling. T / F The primary purpose of Design Patterns is to ease the task of implementing a program. T / F In interface specifications, adding a precondition weakens a specification. T / F In general, the ideal program is one in which all packages are completely stable (i.e., have a stability measure of 1). Aug 4, 2007 Page 2 of 14 CS 246 S07

3 Question 2. (15 marks) C++ 2a. (10 marks) Pointers Provide a C++ implementation that satisfies the following function interface and specification. Be sure to avoid potential memory leaks and segmentation faults. The Supplemental Materials sheets includes a list of operations on STL vector containers. #include <vector> void DeepCopyVector (const std::vector<int*> *v1, std::vector<int*> *v1copy) // modifies: contents of vector *v1copy // ensures: vector *v1copy is a vector of pointers to new integer variables. Each element in // *v1copy points to a new integer variable whose value is the same as the variable // pointed to by the corresponding element in v1. The size of *v1copy equals the // size of *v1. Aug 4, 2007 Page 3 of 14 CS 246 S07

4 Question 2. [continued] 2b. (5 marks) Polymorphism The following set of program fragments define a base class, a derived class, and a main program that uses both classes. The main class includes 10 method calls. For each method call, indicate in the comment following the call how that call is resolved: 1. Base::aMethod() 2. Base::bMethod() 3. Base::cMethod() 4. Derived::aMethod() 5. Derived::bMethod() 6. Derived::cMethod() 7. Derived::dMethod() 8. none of the above - compiler error 9. none of the above - runtime error Each method call is followed by a comment and label, where you should write your answer. In your answers, you may simply use the above number labels rather than writing out the entire answer. For each method call, assume that all previous statements were successful (i.e., did not result in compiler or runtime errors). class Base { public: void amethod(); virtual void bmethod(); virtual void cmethod(); } class Derived : public Base { public: void amethod(); virtual void bmethod(); virtual void dmethod(); private: virtual void cmethod(); } int main (void) { Base *b = new Derived(); b->amethod(); b->bmethod(); b->cmethod(); b->dmethod(); Derived d; d.amethod(); d.cmethod(); d.dmethod(); Base b1 = d; b1.amethod(); b1.bmethod(); b1.cmethod(); // (a) // (b) // (c) // (d) // (e) // (f) // (g) // (h) // (i) // (j) Aug 4, 2007 Page 4 of 14 CS 246 S07

5 Question 3. (10 marks) UML This question asks you to evaluate a UML class diagram and to enhance the model with appropriate UML structural constructs. The class diagram models key parts of an inventory and transactions system for a small coffee and doughnut shop called the C&D. The C&D sells a number of different types of Products. Each Product is identified by a unique product number (prodid). Product numbers are automatically generated when new Products are added to the inventory (via method newprodid()). The inventory system keeps track of how many items of each Product the C&D currently has in stock; it also is responsible for notifying the C&D manager when the instock quantity of a Product falls below a specified threshold, so that the manager can order more. The C&D buys its products from Suppliers. For each Product, the inventory system keeps track of all the Suppliers from which the shop can buy that Product. Some Products can be purchased from more than one Supplier. The inventory maintains a record of each PurchaseOrder that is made, including the Supplier, the quantities of Products ordered, their costs, taxes on the order (PST and GST), and the total cost of the order. The C&D sells food to customers who walk in the door. There is no attempt to keep records of customers. But the system does maintain a record of each Sales transaction, including the Products purchased, the taxes on the Sale, and the total bill of the Sale. The Sale of a Product causes the system to immediately update its record of how many items of that Product the C&D has in stock. Supplier 1..* 1 prodid 1 C&D + order (prodid, int) - newprodid : prodid 1 * Sale PST : double GST : double total cost : double 1 * * prodid 1 1 * 1..* PurchaseOrder PST : double GST : double total cost : double * Product instock : integer saleprice : double threshold : integer + sale (int) + delivery (int) * quantity : integer purchaseprice : double 3a. (5 marks) UML Structures, Navigability Based on the above description of the program and what information needs to be recorded and maintained, detail each of the association ends in the above model with structure (composition, aggregation) and with navigability. (There is only one C&D shop, so all multiplicities on associations to the C&D class are 1). Aug 4, 2007 Page 5 of 14 CS 246 S07

6 Question 3. [continued] The UML model given on the previous page is not necessarily the best model of the C&D inventory and sales transaction system. Below are questions about two different modelling decisions that need to be made. For each question, say which modelling decision is better and explain why. For your convenience, the UML model is duplicated in the Supplemental Materials sheets. 3b. (3 marks) Association Classes In the model on the previous page, a PurchaseOrder is modelled as an ordinary class. Alternatively, we could have modelled PurchaseOrder as an association class of the relationship between the C&D and a Supplier. Supplier 1..* 1 prodid C&D + reorder (prodid, int) PurchaseOrder PST : double GST : double total cost : double Which modelling decision is better for this program and why? (Hint: think about the definition of an ordinary association.) 3c. (2 marks) Qualifiers In the model on the previous page, product numbers are modelled as association qualifiers. Alternatively, we could have modelled product numbers as attributes of the Product and Supplier classes. Which modelling decision is better for this program and why? Aug 4, 2007 Page 6 of 14 CS 246 S07

7 4. (10 marks) Implementing UML Associations This question is based on the annotated UML model that you created in Question 3a, including navigation and structure. 4a. (5 marks) Provide a partial C++ class declaration for the C&D class that realizes the class's associations with Product and Supplier. The class declaration must be complete in declaring all data members, function members, and access specifiers that are needed to implement the class and the two associations to Product and Supplier (do not include data or function members to realize the class's other associations). 4b. (5 marks) Provide a C++ definition for the C&D method to add a new Product. The definition of the method addproduct(...) must realize the two associations' multiplicity and navigation constraints. Use representative names in your declarations. The Supplemental Materials sheets includes partial lists of operations for several STL containers. If you need to, you can assume that the type prodid supports comparison with operator<. Aug 4, 2007 Page 7 of 14 CS 246 S07

8 Question 5. (20 marks) Exceptions and Specifications The following question refers to the IntVector class defined (partially) on the last page of the Supplemental Materials sheets for this exam. In this question, you are to rewrite the class declaration for IntVector to include declarations of the exceptions that might be thrown by the IntVector's methods and to include a proper interface specification. For each condition that could cause a run-time error in one of IntVector's methods, identify the likely standard library exception that would be raised when that condition occurs. (Don't worry about identifying which of two similar exceptions might be thrown for a particular condition. Simply state your assumptions). All exceptions that are raised in the IntVector class will be passed back to the calling code; none will be handled in the IntVector class. Rewrite below the C++ class declaration for the IntVector, so that (10 marks) Each method declaration specifies the exceptions that can be raised in that method, and (10 marks) The class declaration includes as comments an interface specification (contract) Aug 4, 2007 Page 8 of 14 CS 246 S07

9 Question 6. (10 marks) Design Patterns (multiple choice) 6a. (4 marks) (match each Design Pattern on the left with its description on the right) (a) Composite Pattern (b) Decorator Pattern (c) Strategy Pattern (d) Template Pattern 1. Creates a single interface for a collection of objects 2. Creates a single interface for a collection of operations that can operate on specific types of objects. 3. Creates a single interface for a collection of algorithms that access the members of a collection of objects. 4. Creates a single interface for a collection of algorithms that can be used interchangeably to "implement" an object's method. 5. Create a single interface for a collection of features (extra functionality) that can be added to an object 6. Modifies the interface of an object (without adding functionality) 7. Creates interfaces for steps of an algorithm (ensures that subclasses execute the same algorithm, but can specialize the steps) 6b. (2 marks) (circle the most relevant answer) The Factory Method is useful for (a) encapsulating the construction of a concrete object. (b) constructing decorated objects with the right decorators. (c) constructing the appropriate iterator for a composite object. (d) all of the above 6d. (2 marks) (circle the two most relevant answers) The Observer Pattern promotes which of the following design principles: (a) program to an interface, not to an implementation (b) Liskov substitutability principle (c) dependency inversion (d) principle of least knowledge (e) don't repeat yourself (f) open-closed principle 6e. (2 marks) (circle the two most relevant answers) The Visitor Pattern promotes which of the following design principles: (a) program to an interface, not to an implementation (b) Liskov substitutability principle (c) dependency inversion (d) principle of least knowledge (e) don't repeat yourself (f) open-closed principle Aug 4, 2007 Page 9 of 14 CS 246 S07

10 Question 7. (20 marks) Design Patterns (application) This question asks you to use two design patterns to extend the following UML design. For your convenience, the model below is duplicated in the Supplemental Materials sheets. InternetFlix is an internet-based DVD rental company. Customers can ask about the availability of movies and can request to borrow movies (up to 2 movies at a time). The company mails the DVDs out to the customer, and the customer mails the DVDs back when he is done with them. The rental period is four weeks. There is a fee for renting a particular movie (movies have different fees based on whether they are new releases). There is a late fee (assessed daily) for not returning a movie before the end of the rental period. InternetFlix checkavail(movie) : boolean checkout(movie) checkin(move) * Movie title : string onloan : boolean rentalfee: Money latefee: Money loanperiod: duration 1 * Account balance : Money borrow (Movie) return (Movie) Loan duedate: Date Aug 4, 2007 Page 10 of 14 CS 246 S07

11 Question 7. [continued] 7a. (10 marks) Decorator Pattern Use the Decorator Pattern to revise the UML model to offer a Subscription service. If a customer subscribes to this service, then instead of asking to borrow movies one at a time, the customer, as part of this service, maintains a queue of movies that he is interested in renting. Whenever the customer has fewer than two movies out on loan (e.g., whenever a movie is returned), the company finds an available movie that is on the customer's request queue and sends the movie to the customer. With this service, there is no rental fee per loan, no loan period, no late fee. Instead, the customer pays a fixed monthly fee for the privilege of always having two movies out on loan. Your revisions to the UML model should include any new classes, data members, and methods to (1) realize the Decorator Pattern and (2) realize the new Subscription decorator. Aug 4, 2007 Page 11 of 14 CS 246 S07

12 Question 7. [continued] 7b. (10 marks) Visitor Pattern Use the Visitor Pattern to revise the original UML model to allow for the easy addition of operations that operate over all the loans. Include in your revised model a new visitor operation OutstandingFines that computes the total amount of outstanding fines for all overdue movies. Your revisions to the UML model should include any new classes, data members, and methods to (1) realize the Visitor Pattern and (2) realize the new OutstandingFines operation. Aug 4, 2007 Page 12 of 14 CS 246 S07

13 Extra Space for Any Question Aug 4, 2007 Page 13 of 14 CS 246 S07

14 Extra Space for Any Question Aug 4, 2007 Page 14 of 14 CS 246 S07

CS 122/132 Midterm Exam Winter 2003

CS 122/132 Midterm Exam Winter 2003 Date: 24-Feb-2003 Time: 7:00 pm - 9:00 pm Permitted Aids: None CS 122/132 Midterm Exam Winter 2003 Printed Last Initials: ID: Signature: Please check off your PRActicum section from the list below: Arnie

More information

Principles of Software Construction: Objects, Design, and Concurrency

Principles of Software Construction: Objects, Design, and Concurrency Principles of Software Construction: Objects, Design, and Concurrency Designing (sub-) systems Responsibility assignment Charlie Garrod Michael Hilton School of Computer Science 1 Administrivia Reading

More information

CS 247 Software Engineering Principles Midterm Examination **Solutions** Spring 2017

CS 247 Software Engineering Principles Midterm Examination **Solutions** Spring 2017 . Last Name: First Name: ID # CS 247 Software Engineering Principles Midterm Examination **Solutions** Spring 2017 Date: Thursday, June 22, 2017 Time: 4:30 6:20 pm Instructor: C. Kierstead Lecture Section:

More information

CSE 70 Final Exam Fall 2009

CSE 70 Final Exam Fall 2009 Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15

More information

CS 132 Midterm Exam Winter 2002

CS 132 Midterm Exam Winter 2002 Date: 18-Feb-2002 Time: 7:00 pm - 9:00 pm Permitted Aids: None CS 132 Midterm Exam Winter 2002 Printed Last Name: Initials: ID: Signature: Please check off your PRActicum section from the list below: Byron

More information

CS 132 Final Exam Winter 2005

CS 132 Final Exam Winter 2005 Date:20-April-2005 Time:9:00a.m. - 12:00p.m. Permitted Aids:None CS 132 Final Exam Winter 2005 Place sticker here. Signature: Last Name: First Name: ID: Instructions: (Read carefully before the exam begins):

More information

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012

Why Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012 Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design

More information

SDC Design patterns GoF

SDC Design patterns GoF SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating

More information

CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Signature: Question # Out Of Marks Marker Total

CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Signature: Question # Out Of Marks Marker Total CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Please check your tutorial (TUT) section from the list below: TUT 101: F 11:30, MC 4042 TUT 102: M 10:30, MC 4042 TUT 103: M 11:30, MC 4058 TUT 104: F 10:30,

More information

COURSE 2 DESIGN PATTERNS

COURSE 2 DESIGN PATTERNS COURSE 2 DESIGN PATTERNS CONTENT Fundamental principles of OOP Encapsulation Inheritance Abstractisation Polymorphism [Exception Handling] Fundamental Patterns Inheritance Delegation Interface Abstract

More information

CS 132 Midterm Exam Fall 2004

CS 132 Midterm Exam Fall 2004 Date:1-Nov-2004 Time:7:00-9:00p.m. Permitted Aids:None CS 132 Midterm Exam Fall 2004 Please complete this page in ink. Last Name: Signature: First Name: ID: Please check off your Practicum Section: Dana

More information

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107 A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105

More information

Design patterns. Jef De Smedt Beta VZW

Design patterns. Jef De Smedt Beta VZW Design patterns Jef De Smedt Beta VZW Who Beta VZW www.betavzw.org Association founded in 1993 Computer training for the unemployed Computer training for employees (Cevora/Cefora) 9:00-12:30 13:00-16:00

More information

Today's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles

Today's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles CS 247: Software Engineering Principles Reading: none Object-Oriented Design Principles Today's Agenda Object-Oriented Design Principles - characteristics, properties, and advice for making decisions that

More information

Software Engineering I (02161)

Software Engineering I (02161) Software Engineering I (02161) Week 6: Design 1: CRC cards, class and sequence diagram Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2017 Contents Midterm evaluation

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS. MC

CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS. MC CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS JAN 28,2011 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 FINALTERM EXAMINATION 14 Feb, 2011 CS304- Object Oriented

More information

CS 132 Midterm Exam Spring 2004

CS 132 Midterm Exam Spring 2004 Date:22-Jun-2004 Time:7:00-9:00p.m. Permitted Aids:None CS 132 Midterm Exam Spring 2004 Please complete this page in ink. Last Name: Signature: First Name: ID: Please check off your Practicum Section:

More information

CS 349 Midterm Exam Spring 2014

CS 349 Midterm Exam Spring 2014 Course Title: User Interfaces Sections: All Instructor: Byron Weber Becker Exam Date: 19-June-2014 Time: 7:00-9:00p.m. Duration: 2 hours Pages: 10 CS 349 Midterm Exam Exam Type: Closed Book Permitted Aids:

More information

Design Patterns. "Gang of Four"* Design Patterns. "Gang of Four" Design Patterns. Design Pattern. CS 247: Software Engineering Principles

Design Patterns. Gang of Four* Design Patterns. Gang of Four Design Patterns. Design Pattern. CS 247: Software Engineering Principles CS 247: Software Engineering Principles Design Patterns Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch Strategy Pattern Ch 7 Adapter and Facade patterns

More information

CS 247: Software Engineering Principles. Design Patterns

CS 247: Software Engineering Principles. Design Patterns CS 247: Software Engineering Principles Design Patterns Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch 1 Strategy Pattern Ch 7 Adapter and Facade patterns

More information

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am CMSC 202 Section 010x Spring 2007 Computer Science II Final Exam Name: Username: Score Max Section: (check one) 0101 - Justin Martineau, Tuesday 11:30am 0102 - Sandeep Balijepalli, Thursday 11:30am 0103

More information

CSc 328, Spring 2004 Final Examination May 12, 2004

CSc 328, Spring 2004 Final Examination May 12, 2004 Name: CSc 328, Spring 2004 Final Examination May 12, 2004 READ THIS FIRST Fill in your name above. Do not turn this page until you are told to begin. Books, and photocopies of pages from books MAY NOT

More information

May Comp-B 11, Advanced Software Design. 3 hours duration

May Comp-B 11, Advanced Software Design. 3 hours duration May 2016 98-Comp-B 11, Advanced Software Design 3 hours duration NOTES: 1. If doubt exists as to the interpretation of any question, the candidate is urged to submit, with the answer paper, a clear statement

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

More information

The Strategy Pattern Design Principle: Design Principle: Design Principle:

The Strategy Pattern Design Principle: Design Principle: Design Principle: Strategy Pattern The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Design

More information

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D. Software Design Patterns Jonathan I. Maletic, Ph.D. Department of Computer Science Kent State University J. Maletic 1 Background 1 Search for recurring successful designs emergent designs from practice

More information

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 9 OO modeling Design Patterns Structural Patterns Behavioural Patterns

More information

MSO Exam November 7, 2016, 13:30 15:30, Educ-Gamma

MSO Exam November 7, 2016, 13:30 15:30, Educ-Gamma MSO 2016 2017 Exam November 7, 2016, 13:30 15:30, Educ-Gamma Name: Student number: Please read the following instructions carefully: Fill in your name and student number above. Be prepared to identify

More information

Principles of Software Construction: Objects, Design, and Concurrency

Principles of Software Construction: Objects, Design, and Concurrency Principles of Software Construction: Objects, Design, and Concurrency A formal design process Josh Bloch Charlie Garrod Darya Melicher 1 Administrivia Homework 2 feedback in your GitHub repository Homework

More information

Chapter 1: Principles of Programming and Software Engineering

Chapter 1: Principles of Programming and Software Engineering Chapter 1: Principles of Programming and Software Engineering Data Abstraction & Problem Solving with C++ Fifth Edition by Frank M. Carrano Software Engineering and Object-Oriented Design Coding without

More information

In this Lecture you will Learn: Object Design. Information Sources for Object Design. Class Specification: Attributes

In this Lecture you will Learn: Object Design. Information Sources for Object Design. Class Specification: Attributes In this Lecture you will Learn: Object Design Chapter 14 How to apply criteria for good design How to design associations The impact of integrity constraints on design How to design operations The role

More information

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli Identify and overcome the difficulties encountered by students when learning how to program List and explain the software development roles played by students List and explain the phases of the tight spiral

More information

CSCI 102 Fall 2010 Exam #1

CSCI 102 Fall 2010 Exam #1 Name: USC Username: CSCI 102 Fall 2010 Exam #1 Problems Problem #1 (14 points) Problem #2 (15 points) Problem #3 (20 points) Problem #4 (16 points) Problem #5 (35 points) Total (100 points) Problem 1 Short

More information

Exam in TDDB84: Design Patterns,

Exam in TDDB84: Design Patterns, Exam in TDDB84: Design Patterns, 2014-10-24 14-18 Information Observe the following, or risk subtraction of points: 1) Write only the answer to one task on one sheet. Use only the front side of the sheets

More information

CSC 210, Exam Two Section February 1999

CSC 210, Exam Two Section February 1999 Problem Possible Score 1 12 2 16 3 18 4 14 5 20 6 20 Total 100 CSC 210, Exam Two Section 004 7 February 1999 Name Unity/Eos ID (a) The exam contains 5 pages and 6 problems. Make sure your exam is complete.

More information

Principles of Software Construction: Objects, Design, and Concurrency

Principles of Software Construction: Objects, Design, and Concurrency Principles of Software Construction: Objects, Design, and Concurrency Designing (sub-) systems A formal design process Charlie Garrod Michael Hilton School of Computer Science 1 Administrivia Optional

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

CPSC 310: Sample Final Exam Study Questions 2014S1 (These are in addition to the Study Questions listed at the end of some lectures)

CPSC 310: Sample Final Exam Study Questions 2014S1 (These are in addition to the Study Questions listed at the end of some lectures) CPSC 310: Sample Final Exam Study Questions 2014S1 (These are in addition to the Study Questions listed at the end of some lectures) 1. Select the best functional requirement from the list of requirements

More information

Software Engineering I (02161)

Software Engineering I (02161) Software Engineering I (02161) Week 2: Class diagrams part 1 Hubert Baumeister Informatics and Mathematical Modelling Technical University of Denmark Spring 2010 c 2010 H. Baumeister (IMM) Software Engineering

More information

Ministry of Higher Education Colleges of Applied Sciences Final Exam Academic Year 2009/2010. Student s Name

Ministry of Higher Education Colleges of Applied Sciences Final Exam Academic Year 2009/2010. Student s Name Ministry of Higher Education Colleges of Applied Sciences Final Exam Academic Year 2009/2010 Course Number/Name: SFDV4001 Object-Oriented Programming & U.I. Date: Time: College: Sohar[ ] Ibri[ ] Rustaq[

More information

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns EPL 603 TOPICS IN SOFTWARE ENGINEERING Lab 6: Design Patterns Links to Design Pattern Material 1 http://www.oodesign.com/ http://www.vincehuston.org/dp/patterns_quiz.html Types of Design Patterns 2 Creational

More information

Dr. Manal Helal CC316:Object Oriented Programming, Fall 2015 AASTMT College of Engineering & Technology

Dr. Manal Helal CC316:Object Oriented Programming, Fall 2015 AASTMT College of Engineering & Technology OOP Term Project Ideas Goal: To learn how to build and evolve large-scale programs using object-oriented programming, and work in teams learning from each other. Topics: In exploring object-oriented programming,

More information

LABORATORY 1 REVISION

LABORATORY 1 REVISION UTCN Computer Science Department Software Design 2012/2013 LABORATORY 1 REVISION ================================================================== I. UML Revision This section focuses on reviewing the

More information

Software Engineering

Software Engineering Software Engineering CSC 331/631 - Spring 2018 Object-Oriented Design Principles Paul Pauca April 10 Design Principles DP1. Identify aspects of the application that vary and separate them from what stays

More information

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 1 Problem Ralph owns the Trinidad Fruit Stand that sells its fruit on the street, and he wants to use a computer

More information

COEN244: Class & function templates

COEN244: Class & function templates COEN244: Class & function templates Aishy Amer Electrical & Computer Engineering Templates Function Templates Class Templates Outline Templates and inheritance Introduction to C++ Standard Template Library

More information

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS204, 1 st Term 2014 Program 2: FCIT Baqalah Assigned: Thursday, September 26 th, 2013 Due: Wednesday,

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm Ming-Hwa Wang, Ph.D. Department of Computer Engineering Santa Clara University Object Oriented Paradigm/Programming (OOP) similar to Lego, which kids build new toys from assembling

More information

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department CPCS204, 1 st Term 2014 Program 1: FCIT Baqalah Assigned: Monday, February 10 th, 2014 Due: Thursday,

More information

CS304 Object Oriented Programming

CS304 Object Oriented Programming 1 CS304 Object Oriented Programming 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes?

More information

CSCI-1200 Data Structures Fall 2009 Lecture 25 Concurrency & Asynchronous Computing

CSCI-1200 Data Structures Fall 2009 Lecture 25 Concurrency & Asynchronous Computing CSCI-1200 Data Structures Fall 2009 Lecture 25 Concurrency & Asynchronous Computing Final Exam General Information The final exam will be held Monday, Dec 21st, 2009, 11:30am-2:30pm, DCC 308. A makeup

More information

download instant at The Relational Data Model

download instant at  The Relational Data Model 3 The Relational Data Model EXERCISES 3.1 Define data atomicity as it relates to the definition of relational databases. Contrast data atomicity with transaction atomicity as used in a transaction processing

More information

Final Exam. Final Exam Review. Ch 1: Introduction: Object-oriented analysis, design, implementation. Exam Format

Final Exam. Final Exam Review. Ch 1: Introduction: Object-oriented analysis, design, implementation. Exam Format Final Exam Final Exam Review CS 4354 Fall 2012 Jill Seaman Friday, December 14, 11AM Closed book, closed notes, clean desk Content: Textbook: Chapters 1, 2, 4-10 Java Lectures, GRASP + JUnit 35% of your

More information

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas What is this class about? While this class is called Design Patterns, there are many other items of critical

More information

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Cpt S 122 Data Structures. Course Review Midterm Exam # 2 Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm

More information

FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING

FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING Question No: 1 ( Marks: 1 ) - Please choose one Classes like TwoDimensionalShape and ThreeDimensionalShape would normally be concrete,

More information

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. Object Oriented Programming

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. Object Oriented Programming BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT Object Oriented Programming Examiner s Report March 2017 A1. a) Explain what is meant by the following terms:

More information

C++ Inheritance and Encapsulation

C++ Inheritance and Encapsulation C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members

More information

EXAMINATION INSTRUCTIONS

EXAMINATION INSTRUCTIONS EXAMINATION INSTRUCTIONS This examination has 6 pages. Check that you have a complete paper. Each candidate should be prepared to produce, upon request, his or her SUNY/UB card. This examination has 5

More information

Object Oriented Programming

Object Oriented Programming Binnur Kurt kurt@ce.itu.edu.tr Istanbul Technical University Computer Engineering Department 1 Version 0.1.2 About the Lecturer BSc İTÜ, Computer Engineering Department, 1995 MSc İTÜ, Computer Engineering

More information

Release Notes Build 395

Release Notes Build 395 Release Notes Build 395 Build 395.1.0 - Released July 12, 2017 Contents Overview... 1 System Administrator Task List... 7 New Features... 15 Documentation Changes... 24 Overview This latest version of

More information

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING Wednesady 23 rd March 2016 Afternoon Answer any FOUR questions out of SIX. All

More information

CS 162, Lecture 25: Exam II Review. 30 May 2018

CS 162, Lecture 25: Exam II Review. 30 May 2018 CS 162, Lecture 25: Exam II Review 30 May 2018 True or False Pointers to a base class may be assigned the address of a derived class object. In C++ polymorphism is very difficult to achieve unless you

More information

CS 240 Final Exam Review

CS 240 Final Exam Review CS 240 Final Exam Review Linux I/O redirection Pipelines Standard commands C++ Pointers How to declare How to use Pointer arithmetic new, delete Memory leaks C++ Parameter Passing modes value pointer reference

More information

Problem Solving with C++

Problem Solving with C++ GLOBAL EDITION Problem Solving with C++ NINTH EDITION Walter Savitch Kendrick Mock Ninth Edition PROBLEM SOLVING with C++ Problem Solving with C++, Global Edition Cover Title Copyright Contents Chapter

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Department of Computer Engineering Lecture 12: Object-Oriented Principles Sharif University of Technology 1 Open Closed Principle (OCP) Classes should be open for extension but closed

More information

CS304 Object Oriented Programming Final Term

CS304 Object Oriented Programming Final Term 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing

More information

Spring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques

Spring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques 1 CPSC2620 Advanced Programming Spring 2003 Instructor: Dr. Shahadat Hossain 2 Today s Agenda Administrative Matters Course Information Introduction to Programming Techniques 3 Course Assessment Lectures:

More information

Practice Problems. Review, with SOME solutions

Practice Problems. Review, with SOME solutions Practice Problems Review, with SOME solutions Multiple Choice 1. Select the best functional requirement from the list of requirements below. a) A warning dialog should pop up if the student s assignment

More information

SE 2 [CS 446, CS 646, ECE 452, SE 464] Software Design & Architecture Spring 2011 MIDTERM

SE 2 [CS 446, CS 646, ECE 452, SE 464] Software Design & Architecture Spring 2011 MIDTERM SE 2 [CS 446, CS 646, ECE 452, SE 464] Software Design & Architecture Spring 2011 MIDTERM Derek Rayside (SE 464) Electrical & Computer Engineering Atif Khan (CS 446, CS 646, ECE 452) Department of Computer

More information

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1 What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely

More information

JAVA MOCK TEST JAVA MOCK TEST II

JAVA MOCK TEST JAVA MOCK TEST II http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017 OOP components For : COP 3330. Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Data Abstraction Information Hiding, ADTs Encapsulation Type Extensibility Operator Overloading

More information

Software Engineering I (02161)

Software Engineering I (02161) Software Engineering I (02161) Week 5 Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2015 Contents From Requirements to Design: CRC Cards Class Diagrams I Sequence Diagrams

More information

CSSE 220. Interfaces and Polymorphism. Check out Interfaces from SVN

CSSE 220. Interfaces and Polymorphism. Check out Interfaces from SVN CSSE 220 Interfaces and Polymorphism Check out Interfaces from SVN Interfaces What, When, Why, How? What: Code Structure used to express operations that multiple class have in common No method implementations

More information

CMPE/SE 135 Object-Oriented Analysis and Design

CMPE/SE 135 Object-Oriented Analysis and Design Course and Contact Information San José State University Department of Computer Engineering CMPE/SE 135 Object-Oriented Analysis and Design Instructor: Ron Mak Office Location: ENG 250 Email: ron.mak@sjsu.edu

More information

Introduction to Design Patterns

Introduction to Design Patterns Introduction to Design Patterns First, what s a design pattern? a general reusable solution to a commonly occurring problem within a given context in software design It s not a finished design that can

More information

CS 520 Theory and Practice of Software Engineering Fall 2018

CS 520 Theory and Practice of Software Engineering Fall 2018 Today CS 520 Theory and Practice of Software Engineering Fall 208 Object Oriented Design Patterns Recap: Object oriented design principles Design problems & potential solutions Design patterns: What is

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each)

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) 1. An example of a narrowing conversion is a) double to long b) long to integer c) float to long d) integer to long 2. The key

More information

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University

Cpt S 122 Data Structures. Course Review FINAL. Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 Data Structures Course Review FINAL Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Final When: Wednesday (12/12) 1:00 pm -3:00 pm Where: In Class

More information

CAS 703 Software Design

CAS 703 Software Design Dr. Ridha Khedri Department of Computing and Software, McMaster University Canada L8S 4L7, Hamilton, Ontario Other 1 2 3 4 Other Principle of Least Privilege Principle of Fail-Safe Defaults Principle of

More information

CMSC 331 Second Midterm Exam

CMSC 331 Second Midterm Exam 1 10/ 2 10/ 3 60/ 331 First Midterm Exam 16 November 2004 4 10/ 5 20/ CMSC 331 Second Midterm Exam 6 30/ 7 10/ Name: Username: 150/ You will have seventy-five (75) minutes to complete this closed book

More information

CS 2505 Computer Organization I

CS 2505 Computer Organization I Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other computing devices may

More information

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects Lecture 4: Fundamentals of Object Technology Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Credit where Credit is Due Some material presented in this lecture

More information

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Patterns. SE3A04 Tutorial. Jason Jaskolka SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November 18/19, 2014 Jason Jaskolka 1 / 35 1

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecturer: Raman Ramsin Lecture 15: Object-Oriented Principles 1 Open Closed Principle (OCP) Classes should be open for extension but closed for modification. OCP states that we should

More information

INTERNAL ASSESSMENT TEST III Answer Schema

INTERNAL ASSESSMENT TEST III Answer Schema INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object

More information

CS365 Midterm -- Spring 2019

CS365 Midterm -- Spring 2019 CS365 Midterm -- Spring 2019 1. This exam is closed-note, closed-book. 2. You must answer all of the questions. 3. The exam has 120 points and you will be scored out of 120 points. For example, if you

More information

Design patterns. OOD Lecture 6

Design patterns. OOD Lecture 6 Design patterns OOD Lecture 6 Next lecture Monday, Oct 1, at 1:15 pm, in 1311 Remember that the poster sessions are in two days Thursday, Sep 27 1:15 or 3:15 pm (check which with your TA) Room 2244 + 2245

More information

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) Design Pattern CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) A. Design Pattern Design patterns represent the best practices used by experienced

More information

Exam Duration: 2hrs and 30min Software Design

Exam Duration: 2hrs and 30min Software Design Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which

More information

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency. Description of CPSC 301: This is a 2-unit credit/no credit course. It is a course taught entirely in lab, and has two required 2-hour 50-minute lab sessions per week. It will review, reinforce, and expand

More information

A formal design process, part 2

A formal design process, part 2 Principles of So3ware Construc9on: Objects, Design, and Concurrency Designing (sub-) systems A formal design process, part 2 Josh Bloch Charlie Garrod School of Computer Science 1 Administrivia Midterm

More information

Introduction to OO Concepts

Introduction to OO Concepts Introduction to OO Concepts Written by John Bell for CS 342, Fall 2018 Based on chapters 1, 2, and 10 of The Object-Oriented Thought Process by Matt Weisfeld, with additional material from UML Distilled

More information