Вы находитесь на странице: 1из 9

Questions on Class Diagram

QUESTION 1: Consider the world of libraries. A library has books, videos, and CDs that it loans to its
users. All library material has an id# and a title. In addition, books have one or more authors, videos have
one producer and one or more actors, while CDs have one or more entertainers. The library maintains one
or more copies of each library item (book, video or CD).Copies of all library material can be loaned to
users. Reference-only material is loaned for 2hrs and can’t be removed from the library. Other material can
be loaned for 2 weeks. For every loan, the library records the user, the loan date and time, and the return
date and time. For users, the library maintains their name, address and phone number.
Draw a class diagram (or two, if this is more convenient) for the description above. Make sure to show
attributes, multiplicities and aggregations/compositions, where appropriate. No need to show any
operations.
QUESTION 2: Draw a UML class diagram to capture the following situation: “Every student is enrolled
in a course. Each student may be enrolled in a set of units. Some units are core units for one or more courses
and some units are elective units for one or more courses.”
QUESTION 3: Pair programming is an agile software development technique in which two programmers
work together at one work station. One types in code while the other reviews each line of code as it is typed
in. The person typing is called the driver. The person reviewing the code is called the observer. The two
programmers switch roles frequently (possibly every 30 minutes or less). Suppose that you are asked to
build a system that allows Remote Pair Programming. That is, the system should allow the driver and the
observer to be in remote locations, but both can view a single desktop in real-time. The driver should be
able to edit code and the observer should be able to “point” to objects on the driver’s desktop. In addition,
there should be a video chat facility to allow the programmers to communicate. The system should allow
the programmers to easily swap roles and record rationale in the form of video chats. In addition, the driver
should be able to issue the system to backup old work.
Propose a set of classes that could be used in your system and present them in a class diagram. Note: You
only need to include entity objects in your class diagram.

Question 4:
A company consists of departments. Departments are located in one or more offices. One office
acts as a headquarter. Each department has a manager who is recruited from the set of employees.
Your task is to model the system for the company.
Draw a class diagram which consists of all the classes in your system their attributes and
operations, relationships between the classes, multiplicity specifications, and other model elements
that you find appropriate

Question 5:
In a university there are different classrooms, offices and departments. A department has a name and it
contains many offices. A person working at the university has a unique ID and can be a professor or an
employee. A professor can be a full, associate or assistant professor and he/she is enrolled in one
department. Offices and classrooms have a number ID, and a classroom has a number of seats. Every
employee works in an office.
Question 6:
Design a system for a movie-shop, in order to handle ordering of movies and browsing of the catalogue of
the store, and user subscriptions with rechargeable cards. Only subscribers are allowed hiring movies with
their own card. Credit is updated on the card during rent operations. Both users and subscribers can buy a
movie and their data are saved in the related order. When a movie is not available it is ordered.

Question 7:
We want to model a system for management of flights and pilots. An airline operates flights. Each airline
has an ID. Each flight has an ID a departure airport and an arrival airport: an airport as a unique identifier.
Each flight has a pilot and a co-pilot, and it uses an aircraft of a certain type; a flight has also a departure
time and an arrival time. An airline owns a set of aircrafts of different types. An aircraft can be in a
working state or it can be under repair. In a particular moment an aircraft can be landed or airborne. A
company has a set of pilots: each pilot has an experience level: 1 is minimum, 3 is maximum. A type of
aeroplane may need a particular number of pilots, with a different role (e.g.: captain, co-pilot, navigator):
there must be at least one captain and one co-pilot, and a captain must have a level 3.

Question 8:
A bank system contains data on customers (identified by name and address) and their accounts. Each
account has a balance and there are 2 type of accounts: one for savings which offers an interest rate, the
other for investments, used to buy stocks. Stocks are bought at a certain quantity for a certain price
(ticker) and the bank applies commission on stock orders.
Question 9:
A house may have any number of pets living in it. The two possible types of pets that can live in a house
are dogs and cats. Each dog or cat has a name. An animal’s house is its one and only home. You can ell
an animal to make noise and it will do its thing. Draw a class diagram.
Question 10:
.Draw a UML class diagram. A submit server supports two types of users, students and TAs. Students can
submit code to the server. The server must record the time and code for student submissions in a
database. Once submitted, the server must compile code & execute it using test cases as input. Test cases
may be public or private. Scores from executing code for each test case must be recorded and saved in the
database. Students may get their scores for each test case from the server. TAs can also obtain test scores
for all student submissions. In addition TAs can also examine code from all student submissions.
Nouns: Server, User, Student, TA, Time, Code, Submissions, Database, Test Cases, Scores
Verbs: Submit, Record, Compile, Execute, Get (Scores), Examine (Code)
Question 11:
Create the class diagram according to the following elevator control system functional requirements: The
elevator control system shall allow the passenger to call the elevator and to select the destination floor;
When the passenger pushes the external button (to call the elevator), or the internal button (to select the
destination floor), the central control system switches the button light on; When the passenger calls the
elevator or selects the destination floor, the central control system opens/closes the elevator door; When
the passenger calls the elevator or selects the destination floor, the central control system moves/stops the
elevator to/at the passenger call floor or to/at the passenger destination floor. When the passenger leaves
the elevator, the central control system switches the button light off.
Questions on component Diagram
Question:1 There is one bank database which holds the account information of customers. Bank database
is being used by clients, web pages, card readers and ATM machines. Customers will make transactions
through different ATM machines installed everywhere. Every customer has their own ATM card which
they insert in card reader to make transactions. Online transactions are made through web pages which
are further linked with bank database.

Draw a component diagram of the given scenario?

Question:2 Draw a component diagram that shows the relationships for a hospital management system.
Display relevant components for staff category, the room category and the patient category. Try to make
a diagram in this way that it can further scale with the additional new components if required. The staff,
room and patient are three separate packages with their own components inside it and they are
dependent of Hospital category. Every hospital has its own separate operation Theater.

Question :3 Railway Reservation System is a system used for booking tickets over internet. Any Customer
Can book tickets for different trains. Customer can book a ticket only if the tickets are available. Customer
searches for the availability of tickets then if the tickets are available he books the tickets by initially filling
details in a form. Tickets can be booked in two ways by i-ticket or by e-ticket booking. In case of i-ticket
booking customer can book the tickets online and the tickets are couriered to Particular customer at their
address. But in case of e-ticket booking and cancelling tickets are booked and cancelled online sitting at
the home and customer himself has to take print of the ticket but in both the cases amount for tickets are
deducted from customers account. For cancellation of ticket the customer has to go at reservation office
than fill cancellation form and ask the clerk to cancel the ticket than the refund is transferred to customer
account. After booking ticket the customer has to checkout by paying fare amount to clerk.

Create a component diagram of above given scenario?

Question:4 Consider a book store in a shopping mall. The customer selects the books from racks to
purchase. The customer brings selected books to cashier. The cashier scans each item with checkout
system to prepare an order. The cashier requests to customer for payment. The customer gives credit
card to cashier. The verifier and checkout system scans the card. The verifier accepts the card and
payment is accepted. Customer signs the credit card slip. The purchased books are handed over to
customer

Create a component diagram of above given scenario?

Question:5 Now a day’s people should purchase things in stores. It is the System used to maintain the
product details and stock. So in this stock maintenance have the details about the product, purchase, sales
and stock what are the stocks we had. The product details contain product code, Product name, Opening
Stock and Prices. These details are maintained in database. In the purchasing function we must have the
details about the store, quantity and also price. The Sales Details contain Date, Customer name, Product
code, Quantity and Prices. The Stock Details contain product id, opening stock, purchase stock, current
stock, and sales. The stock details are maintaining the database and view the stock between two dates.

Create a component diagram of above given scenario?

Question :6 Ticket vending machine is a vending machine that sells and produces tickets to commuters.
This kind of a machine is a combination of both hardware and software, and it is only a part of the whole
system selling tickets to the customers. Show that ticket vending machine allows commuters to buy
tickets. The ultimate goal of a Commuter in relation to our ticket vending machine is to buy a ticket. We
have a single Purchase Ticket use case, as this vending machine is not providing any other services. Ticket
vending machine is a subject of the example use case diagram. Commuter and Bank are our actors, both
participating in the Purchase Ticket use case.

Draw a component diagram of above given scenario?

Question:7 Tour Reservation System has made life very easy for such visitors by saving both their time
and energy. Visitor requests for scheme to check the availability of the desired tour package. This
information is stored in Tour Information System. System will check whether the customer is existing or
new. New user will enter his personal and tour details for reservation. In turn he/she will be provided with
system generated unique ID and password. This login information could be used for further transactions.
When customer is satisfied with tour package he/she would request for reservation of tour. Personal
details of new customer is stored in cust_info while the details regarding the tour selected by particular
customer is stored in tour_info and the details regarding it would be restructured in Tour Information
System. Existing customer can update his/her personal details in cust_info and cancel reservation for tour
from tour_info and changes regarding it are also reflected in Tour Information System. After confirming
the tour package the customer will make payment either online or through staff by personally going at
the office. Customer can make payment by cash, credit card or by cheque. System checks for the validity
of staff. Once the payment is done by customer, valid staff will make Ticket Reservation System. .Reserved
customer will be able to view details about reservation by providing login information from cust_info and
tour info system. Administrator can add, delete or modify tour schemes from Tour Information System.

Draw a component diagram of above given scenario?

Question:8 The Retail Store Management System is a system designed for managing i.e. for ordering,
arranging and selling goods. The Retailer checks for the availability of goods in the store. If the stock of
goods is less then retailer places order for goods. While ordering the goods, goods area received at store,
the retailer then arranges them by product or by price, and then retailer makes payment. If the stock of
goods is available then he will arrange goods for selling. The retailer then sales the goods directly to the
customer. The customer buys the items from retailer. The retailer prepares bill for goods purchased by
the customer, he receives amount by credit or by cash from customer. The supplier supplies the goods to
the store in the system. The overall system is used to manage the goods in the store.
Draw a component diagram of above given scenario?

Questions on State Diagram

Question:1 Draw a state diagram for ATM machine.ATM is initially turned off. After the power is turned
on, ATM performs start up action and enters Self-Test state. If the test fails, ATM goes into Out of
Service state; otherwise there is trigger less transition to the idle state. In this state ATM waits for
customer interaction.

The ATM state changes from Idle to Serving Customer when the customer inserts banking or credit card
in the ATM's card reader. On entering the Serving Customer state, the entry action read Card is
performed. Note, that transition from Serving Customer state back to the idle state could be triggered
by cancel event as the customer could cancel transaction at any time.

Question:2 Draw a state diagram of an object of class book. Librarians categorise the library books into
loanable and non-loanable books. The non-loanable books are the reference books. However, the
loanable books are the non-reference books. After cataloguing the books, the books are available for
loan. Students who borrow the library books should return them back before the due date. Books that
are 12 months over the due date would be considered as a lost state. However, if those books are found
in the future, they must be returned back to the library. When the books are found not required in the
library or have been damaged, the book would be disposed.

Question:3 For this task, you will create a UML State Diagram of the ShoppingCart object of the Online
DVD Store using Rational Software Development Platform. The ShoppingCart object can be in three
states: “Empty”, “Ready for Check Out”, and “Checking Out”. The ShoppingCart starts in the Empty
state. When a user adds an item, the ShoppingCart will transit to the “Ready for Check Out” state. The
Shopping cart will continue to be in this state while more items are added. The ShoppingCart will transit
to “Checking Out” state when the user is checking out the items in the cart. Once the user finishes
checking out, the ShoppingCart will transit back to the “Empty” state. a) Create the State Diagram in
Rational Software Development Platform. ) Create the State Diagram in Rational Software Development
Platform. Select the Class_DVDStore model under the Class_DVDStore.emx. Right click on it and select
Add Diagram -> State Machine Diagram. b) Rename the diagram to “ShoppingCart State Machine” c)
Complete the State Machine using the State Machine Palette. The finished diagram should look like the
diagram figure below. To add a guard condition, Click on a Transition and add the guard condition in the
Body field in the Guard area.

Question:4 Draw a state diagram for this scenario. A product is to be installed to control elevators in a
building with m floors. The problem concerns the logic required to move elevators between floors
according to the following constraints:

• Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and
cause the elevator to visit the corresponding floor. The illumination is canceled when the elevator visits
the corresponding floor.
• Each floor, except the first floor and top floor has two buttons, one to request and up-elevator
and one to request a down-elevator. These buttons illuminate when pressed. The illumination is
cancelled when an elevator visits the floor and then moves in the desired direction.

• When an elevator has no requests, it remains at its current floor with its doors closed.

The basic course of Action for elevator scenario:

• Passenger presses floor button (that is the button on the wall).

• Elevator system detects floor button pressed.

• Elevator moves to the floor.

• Elevator doors open.

• Passenger gets in and presses elevator button (that is the button in the cabin panel).

• Elevator doors close.

• Elevator moves to required floor.

• Elevator doors open.

• Passenger gets out.

• Elevator doors close.

Question:5 Draw a state diagram for course object.The events that occur in the lifecycle of the Course
object are listed below:

• Create new course—add information for the course or update an existing course; update
information for the course

• Add topics—add topics to the course

• Assign tutors—assign the available tutors for the course

• Close—finished adding or updating the course

Consider the event of adding a new course to the Courseware Management System by the course
administrator. The course administrator fills in the course information, thus initiating the creation of the
Course object.

This event kicks off two events that change the state of the Course object, but are part of the new
course event. These two events contained within the new course creation event are adding topics to the
Course object and assigning tutors for the course. This results in the Topic objects getting associated
with the Course object. Next, the course administrator may wish to assign tutors to teach the course by
identifying the tutors that teach this course (based on their specialty/preferences) and checking the
availability of the tutors for a given period of time. This completes the lifecycle Course object until the
time an update course event occurs.

Question:6 Draw a UML state transition diagram corresponding to the computer keyboard state
machine. In UML, states are represented as rounded rectangles labelled with state names. The
transitions, represented as arrows, are labelled with the triggering events followed optionally by the list
of executed actions. The initial transition originates from the solid circle and specifies the starting state
when the system first begins. Every state diagram should have such a transition, which should not be
labelled, since it is not triggered by an event. The initial transition can have associated actions.

Question:7 Draw an uml state diagram for chess game. A chess game consists of alternate moves of
Black and White. White moves first. The game can end both when it is White’s and when it is Black’s
turn. The moving player can end the game: winning (checkmate), loosing (resign), or with a draw.

Question:8 Draw a state diagram here the machine is a bottle in a bottling plant. It begins in the empty
state. In that state it can receive squirt events. If the squirt event causes the bottle to become full, then
it transitions to the full state, otherwise it stays in the empty state (indicated by the transition back to its
own state). When in the full state the cap event will cause it to transition to the sealed state. The
diagram indicates that a full bottle does not receive squirt events, and that an empty bottle does not
receive cap events. Thus you can get a good sense of what events should occur, and what effect they
can have on the object.

Question:9 Draw a state diagram for toaster. First of all we must turn on the toaster, put in the bread
and wait for several minutes to bake it. The initial state diagram for making a toast But this is not the
final state diagram. To prevent burning out the bread, heater of the toaster must produce heat in
temperature interval (upper and lower temperature limits). For this purpose thermometer measures the
temperature of heater, and when the upper limit of temperature is reached then heater must go into
idle state. This state resists until heater's temperature decreases to lower limit, and then working state
is again aimed.

Question:10 Draw a state diagram for a state machine that reads in a sequence of bits, one bit at a time,
and outputs a 1 whenever the sequence 1110 is detected. It outputs a 0 otherwise. The machine keeps
detecting the sequence and never stops.

Question:11 Draw a state diagram. The door can be in one of three states: "Opened", "Closed" or
"Locked". It can respond to the events Open, Close, Lock and Unlock. Notice that not all events are valid
in all states; for example, if a door is opened, you cannot lock it until you close it. Also notice that a state
transition can have a guard condition attached: if the door is opened, it can only respond to the Close
event if the condition doorWay->isEmpty is fulfilled.
Question:12 Draw a state machine diagram for DICOM Application Hosting API. The Application Hosting
API describes interfaces between two software applications - Hosting System and Hosted Application,
exchanging medical data while located on the same system.

Hosting system initializes hosted application by issuing a run or exec command or its equivalent. Once
the hosted application is initialized, for the normal workflow its state transitions through Idle, In
Progress, and Completed states. In some cases application could be Suspended or even Cancelled.

Question:13 Draw a State Machine Diagram to show the following behaviours of a DVD player. Be sure
to label all transitions with the events that cause them. The DVD player is initially off. It can turned on or
off by pressing the power button. When it is off, none of the other buttons do anything. When it is on,
the tray can be opened or closed by pressing the eject button. When it is open, only the power and eject
buttons will do anything. When the tray is closed, the motor is either spinning or stopped. When you
turn on the power or close the tray, the machine first spins up the motor to read the disk. It then gets
one of three signals: (a) no disk – it stops the motor, and disables all buttons other than eject and
power. (b) timeout, indicating it was unable to read the disk – it stops the motor, displays an error
message, and disables all buttons other than eject and power. (c) disk okay – it stops the motor, but
enables the play control buttons. There are three play control buttons. Play starts the DVD playing,
spinning up the motor if necessary. Pause toggles between playing and paused, without stopping the
motor. Pause does nothing if pressed when the motor is stopped. Stop stops the motor, if it was
spinning

Question:14 Draw a protocol state diagram. The states of a protocol state machine (protocol states)
present an external view of the class that is exposed to its clients. Depending on the context, protocol
states can correspond to the internal states of the instances as expressed by behavioural state
machines, or they can be different.

The states of protocol state machines are exposed to the users of their context classifiers. A protocol
state represents an exposed stable situation of its context classifier: When an instance of the classifier is
not processing any operation, users of this instance can always know its state configuration.

States of a protocol state machine cannot have entry, exit, or do activity actions. Protocol state
machines also cannot have deep or shallow history pseudo states.

Question:15 A light switch will have two states: up and down. (We could call them "on" and "off"
if we liked.) Draw a UML state diagram. A light switch only has one possible event: the switch gets
flipped. We could call this two different events (gets flipped up, gets flipped down) but the net
effect is the same. One could argue that our light switch really has hundreds of thousands or
millions of states, since every time we flip the switch it wears out just a little bit, and eventually
will fail if we flip it enough. We only include the states of the system when it is working in its
normal course of operation. Although the actual number of possible events that could happen
to any system.
Question:16 Draw a state machine diagram for the Seminar class during registration. The rounded
rectangles represent states: you see that instances of Seminar can be in the Proposed, Scheduled, Open
for Enrolment, Full, and Closed to Enrolment states. An object starts in an initial state, represented by
the closed circle, and can end up in a final state, represented by the bordered circle.

Question:17 Draw a protocol state machine diagram showing thread states and thread life cycle for the
Thread class in Java

Thread is a lightweight process, the smallest unit of scheduled execution. Instance of the Thread class in
Java could be in one of the following states: new, runnable, timed waiting, waiting, blocked, terminated.

Вам также может понравиться