0% found this document useful (0 votes)
20 views13 pages

IS222 Semester 1, 2012

IS222 Semester 1, 2012

Uploaded by

diristi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views13 pages

IS222 Semester 1, 2012

IS222 Semester 1, 2012

Uploaded by

diristi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

The University of the South Pacific

Serving the Cook Islands, Fiji, Kiribati, Marshall Islands, Nauru, Niue, Samoa, Solomon Islands, Tokelau, Tonga, Tuvalu, and Vanuatu.

School of Computing, Information and


Mathematical Sciences

IS222: Database Management Systems

FINAL EXAMINATION – SEMESTER 1, 2012

Time Allowed 3 hours plus 10 minutes reading

100 marks (40% of final grade)


INSTRUCTIONS

1. This exam has two sections:


a. Section A: 20 marks
b. Section B: 80 marks
2. Answer all questions in sections A and B. There are no choices.
3. The answers to questions 1 – 20 in section A must be clearly written on the
Special Multiple Choice Answer Sheet provided together with this paper
and that sheet should be handed in with your answer book.
4. Answer all questions in section B in the answer booklet provided.
5. This exam is worth 40% of your overall mark. The minimum mark to pass
the final exam is 40/100.
6. There are 12 pages in this booklet including this page.
Section A – Multiple Choice Questions (20 marks) (Each question has only one answer
and is worth 1 mark)

1. Which of the following might be represented with a multivalued attribute?


a. Person’s name
b. Book title
c. Bank account balance
d. Class location

2. Dependencies can be identified with the help of the dependency ____.


a. form
b. schema
c. diagram
d. database

3. Dependencies based on only a part of a composite primary key are called ____
dependencies.
a. primary
b. partial
c. incomplete
d. composite

4. A ____ relationship exists when two entities are associated.


a. unary
b. binary
c. ternary
d. weak

5. A table that displays data redundancies yields ____.


a. anomalies
b. inconsistencies
c. fewer attributes
d. more entities

6. The referential integrity rule requires that ____.


a. every null foreign key value must reference an existing primary key value
b. an attribute have a corresponding value
c. every non-null foreign key value reference an existing primary key value
d. you delete a row in one table whose primary key does not have a matching
foreign key value in another table

7. In a relationship, when a primary key from one table is also defined in a second
table, the field is referred to as a ____ in the second table.
a. combined key
b. redundant field
c. primary key
d. foreign key

Page 2 of 12
8. Which of the following statements concerning the primary key is true?
a. The primary key must not be null.
b. The primary key may be null.
c. The primary key is not required for all tables.
d. The primary key data do not have to be unique.

9. A primary key ____.


a. consists of only one field
b. has the same value for all records
c. must contain a unique value for each record within the table
d. is defined automatically

10. A ____ attribute can be further subdivided to yield additional attributes.


a. composite
b. simple
c. single-valued
d. multivalued

11. A ____ entity has a primary key that is partially derived from the parent entity in the
relationship.
a. strong
b. weak
c. business
d. relationship

12. When designing a database, you should ____.


a. make sure entities are in normal form before table structures are created
b. create table structures then normalize the database
c. only normalize the database when performance problems occur
d. consider more important issues such as performance before normalizing

13. ANSI-standard SQL allows the use of special operators in conjunction with the
WHERE clause. A special operator used to check whether an attribute value
matches a value contained within a subset of listed values is ____.
a. BETWEEN
b. IS NULL
c. LIKE
d. IN

14. What operator could be used in place of MINUS if the RDBMS does not support it?
a. IN
b. NOT IN
c. AND
d. UNION

Page 3 of 12
15. When using an equality (=) or inequality (<, >, etc.) operator for a subquery, what
type of value must the subquery return?
a. single value
b. list of values
c. no value
d. virtual table

16. A ____ is a query (SELECT statement) inside a query.


a. subquery
b. basequery
c. join
d. set query

17. In a subquery, which query is executed first?


a. Leftmost
b. Rightmost
c. Innermost
d. Outermost

18. ____ control is the management of concurrent transaction execution.


a. Database
b. Lock
c. Transaction
d. Concurrency

19. Lock ____ indicates the level of lock use.


a. granularity
b. shrinking
c. growing
d. serializability

20. All transactions are controlled and executed by the ____ to guarantee database
integrity.
a. scheduler
b. DBMS
c. transaction log
d. DBA

Page 4 of 12
Section B – Short and Long Answer Questions

Question 21 – Entity Relationship Modelling (34 marks)

Use the following description to answer parts (A) to (D) of this question.

The data given below is a sample employee timesheet for employees of ABC
Construction Company. The company constructs buildings. It has a number of
departments: Finance, Electrical, Plumbing and Carpentry. Each department has many
employees but each employee works for exactly one department.

All employees of the Electrical, Plumbing and Carpentry departments are required to
submit a timesheet showing the jobs they have done at the end of each week. A sample
timesheet for employee Smith Thomas, who works for the Electrical department, is given
in Figure 1.

ABC Construction Company: Time Sheet


Employee No: Name: Title (Mr, Mrs, Miss, Ms):
124298 Smith Thomas Mr
Department: Electrical
Telephone Extension: 5850
Bank Account No: 1231-456783-58
Date Job No Operation Charge Rate Time Time Finish Time (Hrs
($) Start Worked)
31/07/06 3421 45 - Cabling 10 8.00 12.00 4
01/08/06 3421 45 - Cabling 10 8.00 12.00 4
01/08/06 3421 45 - Cabling 10 12.30 16.30 4
02/08/06 2310 21 – Faulty 16 8.00 10.00 2
Wiring
02/08/06 3421 98 - Insulation 12 10.30 12.30 2
02/08/06 4812 21 – Faulty 16 13.00 16.30 3.5
Wiring
Total Hours 19.5
Worked:
Figure 1

An employee can be involved in many jobs and each job can contain one or many
operations. Each job has a unique number, description, and a manager. Each operation
has a unique ID number, description and hourly charge. An operation can be performed
by at least one employee but each employee specialises in exactly one job.

We would like to design a MS Access database to be able to store the timesheets of all
employees in the three departments (Electrical, Plumbing and Carpentry). This database
will then be used by the Finance department to make the pay of the employees in these
three departments.

Page 5 of 12
(A) What are some techniques the database designer can apply to identify the business
rules? (2 marks)

(B) Identify all possible business rules for the above case study. (8 marks)

(C) Create an ERD showing a possible database design. Show the entities, relationship
between the entities (show the connectivity, cardinality, and strength of relationship),
primary and foreign keys, and other attributes. (22 marks)

(D) After creating the ERD, briefly discuss the following:


i. How do the business rules help you when creating the ERD? (1 mark)

ii. Choose any one attribute that should be indexed apart from the primary and
foreign keys, and briefly justify your choice. (1 mark)

Page 6 of 12
Question 22 – Normalization (18 marks)

Use the following description and the three tables to answer parts (A) and (B) of this
question.

A transport company provides a number of trucks for cartage purposes. These trucks are
hired by people for a number of different reasons, for example, for carting household
items when moving from one house to another.

The trucks operate from a base, which is managed by at least one employee of the
company. A truck may operate from one or multiple bases over a period of time. A base
will have at least one truck at any given time.

The company hired a database designer to create a MS Access database that could be
used by the company to store details about the trucks. The implemented MS Access
database contains three tables, which are provided together with the relational schema in
Figure 2.

Base
Base City State Area Code Phone Manager
501 Murfreesboro TN 615 123-4567 or 123-4577 Andrea D. Gallager
502 Lexington KY 568 234-5678 or 234-5699 Andrea D. Gallager
and
Maria J. Talindo
503 Cape Girardeau MO 456 345-6789 Maria J. Talindo
504 Dalton GA 901 456-7890 Peter F. McAvee

Truck
Truck # Base Base City Base Phone Truck Miles Serial Num
Type
1001 501 Murfreesboro 123-4567 or 123- 1 32123.5 AA-322-12212-W11
4577
1002 501 Murfreesboro 123-4567 or 123- 1 76984.3 AC-342-22134-Q23
4577
1002 502 Lexington 234-5678 or 234- 1 76984.3 AC-342-22134-Q23
5699
1003 501 Murfreesboro 123-4567 or 123- 2 12346.6 AC-445-78656-Z99
4577
1003 503 Cape Girardeau 345-6789 2 12346.6 AC-445-78656-Z99
1005 503 Cape Girardeau 345-6789 2 45673.1 FR-998-32245-W12
1006 501 Murfreesboro 123-4567 or 123- 2 93245.7 AD-456-00845-R45
4577
1006 503 Cape Girardeau 345-6789 2 93245.7 AD-456-00845-R45

Page 7 of 12
Truck Type
Type Description
1 Single box, double-axle
2 Single box, single-axle
3 Tandem trailer, single-axle

Figure 2

(A) Discuss some problems with the design of above database and provide examples of
the problems that you have identified. (4 marks).

(B) The current database has three tables. Redesign, that is normalize, the database so that
all the tables are in 3NF and create the dependency diagrams for all the tables in your
re-designed database. Use the primary keys identified in the relational schema for the
normalization process. (14 marks)

Page 8 of 12
Question 23 – Transaction Management (11 marks)

(A) What is concurrency control, and what is its objective? (2 marks)

(B) Suppose you are a manufacturer of product ABC, which is composed of parts A, B,
and C. Each time a new product (ABC) is created, it must be added to the product
inventory, using the PROD_QOH in a table named PRODUCT. This means that we
will update the PRODUCT table by increasing the PROD_QOH by 1 (one) to
indicate that we have one more of product ABC in our stock/inventory. And each
time the product ABC is created, the parts inventory, using PART_QOH in a table
named PART, must be reduced by one each of parts A, B, and C to indicate that we
have used 1 each of A, B, and C to make product ABC. The sample database
contents are shown in Figure 3.
Table name: PRODUCT Table name: PART
PROD_CODE PROD_QOH PART_CODE PART_QOH
ABC 23 A 56
B 12
C 45

Figure 3
Using the following transaction (in Figure 4), write the transaction log using the table
given in Figure 5 as your template.

SQL statements

BEGIN TRANSACTION

UPDATE PRODUCT
SET PROD_QOH = PROD_OQH + 1
WHERE PROD_CODE = ‘ABC’

UPDATE PART
SET PART_QOH = PART_OQH - 1
WHERE PART_CODE = ‘A’

UPDATE PART
SET PART_QOH = PART_OQH - 1
WHERE PART_CODE = ‘B’

UPDATE PART
SET PART_QOH = PART_OQH - 1
WHERE PART_CODE = ‘C’

COMMIT;
Figure 4

Page 9 of 12
We assume that product ‘ABC’ has a PROD_QOH = 23 at the start of the transaction and
that the transaction is representing the addition of 1 new product. We also assume that
PART components “A”, “B” and “C” have a PROD_QOH equal to 56, 12, and 45
respectively. (9 marks)

TRL TRX Prev Next Row Before After


ID Num PTR PTR Operation Table ID Attribute Value Value

Figure 5

Page 10 of 12
Question 24 – Structured Query Language (17 marks)

Use the following description and the ERD given below (see Figure 6) to answer parts
(A) to (E) of this question. Write SQL statements to answer each part and your SQL
statement should be written for a MySQL database.

You are given a database that is used by a video library to store data about movies, copies
of each movie, borrowers, and renting of the movies. A movie can have one or more
copies. Each copy can be rented by one of more borrowers.

Figure 6

Page 11 of 12
(A) List the details of all borrowers, sorted by their last name in increasing order.
(2 marks)

(B) List the number and names of all borrowers that have not borrowed any movies.
(3 marks)

(C) List the code(s), name(s) and the price of the most expensive movie(s) [Hint: use the
movie_charge column]. (3 marks)

(D) List the movie code, name and the number of copies of each movie that has more
than two copies. (4 marks)

(E) List the movie code and name of all movies where at least one copy of the movie has
never been borrowed. (5 marks)

Page 12 of 12
IS222 – Final Exam Semester 1 2012

Section A – Multiple Choice Answer Sheet


(Please submit this sheet together with your answer booklet)

Student ID: _____________________ Name: ______________________________

Seat Number: _____________________

1. (A) (B) (C) (D)

2. (A) (B) (C) (D)

3. (A) (B) (C) (D)

4. (A) (B) (C) (D)

5. (A) (B) (C) (D)

6. (A) (B) (C) (D)

7. (A) (B) (C) (D)

8. (A) (B) (C) (D)

9. (A) (B) (C) (D)

10. (A) (B) (C) (D)

11. (A) (B) (C) (D)

12. (A) (B) (C) (D)

13. (A) (B) (C) (D)

14. (A) (B) (C) (D)

15. (A) (B) (C) (D)

16. (A) (B) (C) (D)

17. (A) (B) (C) (D)

18. (A) (B) (C) (D)

19. (A) (B) (C) (D)

20. (A) (B) (C) (D)

You might also like