Blog
Object Oriented Analysis and Design Past Paper 2016 – BSCS 5th Term UOS (SE-3311)
University of Sargodha BS Computer Science 5th term Object Oriented Analysis & Design (SE-3311) paper, 2016 exam (80 marks, 2:30 hours). The paper is retyped below without the handwritten name, number and ticks, followed by solved answers for all 16 short questions and all five subjective questions: restaurant-bill activity and use case diagrams, class and sequence diagrams for the DVD purchase, the RUP model, a package diagram for ATM software and the Gang of Four.
Solved answers
Q1 – Short answers (16 × 2)
i. Factors estimated in inception. Business case and scope, main use cases, cost and schedule estimates, critical risks, feasibility, and a candidate architecture – enough to decide whether to continue the project.
ii. RUP phase where formal testing starts. Testing is a discipline throughout RUP, but formal testing of the developed system starts in the Construction phase (system/integration testing), with acceptance/beta testing in Transition.
iii. Revolution supporting reusability and encapsulation. The object-oriented programming revolution (Simula, Smalltalk, C++, Java) – classes encapsulate data and behaviour and can be reused through inheritance and composition.
iv. Object-oriented analysis. Studying the problem domain and expressing requirements as interacting objects – finding classes, attributes, operations and relationships, with use case, domain (class) and interaction models – describing what the system must do.
v. Types of UML diagrams. Structural: class, object, component, deployment, package, composite structure, profile. Behavioural: use case, activity, state machine, and interaction diagrams (sequence, communication, timing, interaction overview).
vi. Three basic elements of an activity diagram. Initial node, action (activity) and control flow; also decision/merge, fork/join, final node and swimlanes.
vii. Role of a trigger in a state machine. The trigger is the event that fires a transition from one state to another (e.g. pinEntered), possibly with a guard condition and an action.
viii. Components of a class in a class diagram. Three compartments: name, attributes and operations.
ix. Default visibility. UML itself has no default (visibility is unspecified if not shown). In practice attributes are taken as private (−) and operations public (+); in Java the default is package (~).
x. Generalization and specialization. Generalization combines common features of classes into a superclass; specialization creates subclasses with extra features. Shown with a hollow triangle arrow to the superclass:
Account
▲ ▲
Savings Currentxi. Two types of interaction diagrams. Sequence diagrams (time order of messages) and communication (collaboration) diagrams (object links and numbered messages).
xii. Importance of package diagram. It organises a large model into logical groups and shows dependencies, helping to manage complexity, layering, team division and change impact.
xiii. Basis for grouping elements into packages. Elements that are closely related – by functionality/subsystem, layer (UI, business, data), common closure (change together) and high cohesion with low coupling between packages.
xiv. Types of requirements. Two main types: functional and non-functional (quality) requirements; often also domain requirements, and user vs system requirements. In FURPS+: Functionality, Usability, Reliability, Performance, Supportability, plus constraints.
xv. Pre-conditions. Conditions that must be true before a use case can start, e.g. “the customer is logged in” before “Place order”.
xvi. Purpose of a sequence diagram. To show how objects interact in a scenario by the time-ordered sequence of messages exchanged – used to design and document use-case realizations.
Q2 – Restaurant bill: activity and use case diagrams
Activity diagram
(●)
|
[Waiter opens order for table]
|
[Add charge for each delivered item] <--------+
| |
<more items delivered?> --yes-----------------+
|no
[Compute subtotal = Σ item charges]
|
<party size >= 6 ?> --yes--> [Add tax + 18% service charge] --+
|no |
+--------------------------> <merge> <-----------------------+
|
<coupon submitted?> --yes--> [Subtract coupon value] --+
|no |
+--------------> <merge> <------------------+
|
[Print / present final bill]
|
(◉)Use case diagram
+------------ Restaurant Billing System ------------+
| |
Waiter ------|---- (Record delivered item) |
| | |
+---------|---- (Generate bill) ---<<include>>---> (Calculate total)
| | \ |
| | \--<<extend>>-- (Apply 18% service |
| | [group >= 6] charge & tax) |
| +--<<extend>>-- (Apply coupon) |
Customer ----|---- (Submit coupon) |
| | |
+---------|---- (Pay bill) |
Cashier -----|---- (Receive payment) |
+----------------------------------------------------+Q3 – Class and sequence diagrams for the DVD purchase
Class diagram
+-----------+ 1 * +------------+ * 1 +-----------+
| Customer |---------| Order |---------| DVD |
| -name | places | -orderNo | for | -model |
| -address | | -date | | -price |
| -phone | | -status | +-----------+
| +call() | | +ship() |
| +install()| +-----+------+
| +pay() | | 1
+-----+-----+ | 0..1
| +------+------+
| | Payment |
| | -amount |
| | -date |
| +-------------+
| contacts
+-----v------------------------------+
| Department {abstract} |
| -name, -phone |
+-----^------^-------^-------^-------^-+
| | | | |
Sales Customer Engineering Mail Accounts
Support +advise() +ship() +receivePayment()
+putOnHold()
+suggestDVD()Sequence diagram
:Customer :Sales :CustSupport :Engineering :MailDept :Accounts
| | | | | |
|--call---->| | | | |
|<-contact support-------| | | |
|--call------------------>| | | |
|<--put on hold-----------| | | |
| | |--consult---->| | |
| | |<-supported DVD options------| |
|<--DVD options-----------| | | |
|--choose DVD------------>| | | |
| | |--ship order(DVD)----------->| |
|<-------------------------------------- deliver DVD --| |
|--install() | | | |
|--mail payment------------------------------------------------- ->|
|<------------------------------------------------------ receipt --|Q4 – RUP model and how it differs from other SDLC models
The Rational Unified Process (RUP) is an iterative and incremental, use-case driven, architecture-centric software process developed by Rational Software (IBM). Development is divided into four phases, each ending with a milestone, and each phase has one or more iterations:
- Inception – business case, scope, key use cases, risks, cost/schedule estimate. Milestone: lifecycle objectives.
- Elaboration – analyse domain, detailed use cases, establish and test a stable architecture, address major risks. Milestone: lifecycle architecture.
- Construction – build the remaining components and features in iterations, integrate and test. Milestone: initial operational capability (beta).
- Transition – beta testing, training, deployment, user acceptance. Milestone: product release.
Across the phases run nine disciplines (workflows): business modelling, requirements, analysis & design, implementation, test, deployment, plus configuration & change management, project management and environment. The RUP “hump chart” shows how much effort each discipline needs in each phase. Six best practices: develop iteratively, manage requirements, use component-based architecture, model visually (UML), continuously verify quality, control changes.
RUP vs other SDLC models
| RUP | Waterfall / other models |
|---|---|
| Iterative and incremental – working software in each iteration | Waterfall is sequential – software appears only at the end |
| Risks addressed early (architecture proven in Elaboration) | Risks discovered late, during testing |
| Requirements can change between iterations | Requirements frozen at the start |
| Disciplines overlap in all phases | Each activity is a separate stage done once |
| Use-case driven and UML based, architecture-centric | Document driven; no specific modelling language |
| Heavier, more process and documents than agile (Scrum/XP) | Agile is lighter; spiral is risk-driven like RUP but less prescriptive |
Q5 – Package diagram
A package diagram is a UML structural diagram that organises model elements (classes, use cases, components, other packages) into packages (folder-shaped icons) and shows the dependencies between them (dashed arrows, e.g. «import», «access»).
Benefits / purpose: manages complexity of large systems; shows the high-level, layered architecture; groups related classes with high cohesion and shows coupling between groups; supports division of work among teams; helps analyse the impact of change and plan builds/namespaces.
Package diagram for ATM software
+--------------------+ +----------------------+
| User Interface |------->| Transaction Mgmt |
| - Screen | uses | - Withdrawal |
| - Keypad | | - Deposit |
| - Display | | - BalanceInquiry |
+---------+----------+ | - Transfer |
| +----+-----------+-----+
v | |
+--------------------+ v v
| Authentication |<------+---------------+ +----------------+
| - CardReader | | Account Mgmt | | Hardware Ctrl |
| - PINValidator | | - Account | | - CashDispenser|
| - Session | | - Customer | | - Printer |
+---------+----------+ +-------+-------+ | - DepositSlot |
| | +----------------+
v v
+---------------------------------------------+
| Bank Communication / Database |
| - BankServer proxy - TransactionLog |
+---------------------------------------------+
(arrows = dependencies «use»)Q6 – Gang of Four
The Gang of Four (GoF) – Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides – wrote Design Patterns: Elements of Reusable Object-Oriented Software (1994), which documents 23 classic design patterns. A design pattern is a general, reusable solution to a commonly occurring design problem in a given context; it is a template, not finished code.
| Category | Concern | Patterns |
|---|---|---|
| Creational (5) | object creation | Abstract Factory, Builder, Factory Method, Prototype, Singleton |
| Structural (7) | composition of classes/objects | Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy |
| Behavioural (11) | communication and responsibility | Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor |
Examples: Singleton – only one instance of a class, e.g. a logger. Facade – a simple interface to a complex subsystem, e.g. an ATM class hiding card reader, dispenser and bank server. Observer – subscribers are notified of changes, e.g. GUI listeners. Composite – treat individual objects and groups the same, e.g. menus containing items and sub-menus. Decorator – add responsibilities dynamically, e.g. Java I/O streams.
Principles promoted: program to an interface, favour composition over inheritance, encapsulate what varies. Benefits: reusable proven designs, common vocabulary, flexibility and maintainability.
