Introduction to Database Systems - Exam

THE UNIVERSITY OF DODOMA
COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION
SCHOOL OF INFORMATICS

UNDERGRADUATE UNIVERSITY EXAMINATIONS
SECOND SEMESTER 2022/2023

CP 121 : INTRODUCTION TO DATABASE SYSTEMS

Time Allocated: 3 Hours

INSTRUCTIONS:

  1. This paper consists of seven questions.
  2. Answer all questions in Section A and any two questions from Section B.
  3. All University of Dodoma examination regulations apply.

SECTION A: (40 MARKS)

Attempt ALL questions from this section

Question One

Read each question carefully and choose the most correct response. (1 Mark Each)

i. The Relational Database Management Systems (RDBMS) provides all but which of the following?
A. Facilities for creating and maintaining relational schema
B. Automated conversion of ERD into relational schema
C. Concurrency control via transaction management
D. Facilities to manipulate data in relational schema
E. Integrity checking that forbids data changes that would violet integrity

ii. Given the basic ERD and relational models, which of the following is INCORRECT?
A. An attribute of an entity can have more than one value
B. In a row of a relational table, an attribute can have more than one value
C. An attribute of an entity can be composite
D. In a row of a relational table, an attribute can have exactly one value or a NULL value
E. Some entities in an entity set may not participate in the relationship.

iii. Failure to specify cascading delete when enforcing referential integrity can cause what problem?
A. The primary key may no longer be unique in a given table
B. The primary key values in the originating table will all change to default values.
C. There will be no control over the creation of duplicate data
D. A foreign key may reference a value in the originating table that no longer exists.
E. All the records in a given table can be accidentally deleted

iv. The following activities of the database development life cycle are not arranged in order; which sequence arrange them logically?
I. Select a suitable DBMS for the database system.
II. Conceptual, logical and physical database design
III. Specifying the scope and boundaries of the database systems
IV. Planning how the stages of the life cycle can be realized
V. Collecting and analyzing the database requirements

A. I, II, IV, V, and III
B. IV, III, I, V, and II
C. V, IV, III, II, and I
D. IV, III, V, II, and I
E. I, III, II, IV and V

v. In relational database model, after conceptually designing your database, the information contained in a single class would be stored in a:
A. Field
B. Attribute
C. Database
D. Table
E. Key

vi. Basic form for assigning access statement in DBMS is
A. create <privilegelist>
B. assign <privilegelist>
C. assign&define<privilegelist>
D. define <privilegelist>
E. grant <privilegelist>

vii. Which of the following constraints cannot be added to an existing table with the ADD Clause of the alter table command?
A. CHECK
B. NOT NULL
C. UNIQUE
D. REFERENCES
E. PRIMARY

viii. Count function in SQL returns the number of:
A. Values
B. Distinct values
C. Groups
D. Rows
E. Columns

ix. Consider the statement: CREATE TABLE T1 AS SELECT * FROM Regions WHERE 1=2
A. There will be an error because of the impossible condition
B. No table will be created because the condition return FALSE
C. The table T1 will be created but no rows inserted because the condition return FALSE
D. The table T1 will be created and every row in Regions inserted because condition return a NULL.
E. The table T1 will be created and every row in Regions inserted because condition return a TRUE.

x. Which SQL command is used to eliminate duplicate records from a query result?
A. COMBINE
B. DISTINCT
C. GROUP BY
D. TOP [ ]
E. UNIQUE


Question Two

Match the item in Column A with its corresponding item in Column B. (1 Mark Each)

Column AColumn B
i. Data Definition Language (DDL)A. Distributed database System
ii. Modifying the database by adding a record types or data items or deleting some data items.B. Candidate key
iii. Useful for the applications that have to query extremely large database or that have to process an extremely large number of transactions per second.C. A sudent’s GPA must be between 0.00 and 5.00
iv. Most of the functions such as update, backup, query, control access and so on, are easier to accomplish.D. Parallel Database Systems
v. WHERE CustomerName LIKE %br%?E. ALl students should have a registration number
vi. A set of one or more attributes that, taken collectively, allow identifying uniquely a tuple in the relation.F. ALTER, CREATE RELEASE
vii. At some point it can have more values.G. Logical data linkage
viii. General integrity constraintsH. Do not add an ORDER BY CLAUSE
ix. Creating additional access structure to improve the performance of the retrieval or updateI. Physical Data Independence
x. Multiple-row operators in sub-queryJ. Super key.
K. Retrive customer names(s) ending with br.
L. Logical database schema
M. Multivalued attribute
N. Foreign Key
O. Primary Key
P. IN, ANY and ALL
Q. Centralized Database System
R. CHECK
S. IN, ANY and BETWEEN
T. Retrieve customer names containing br.

Question Three

Write T for the correct statement and F for the incorrect statement is your answer booklet provided. (1 Mark Each)

a. In the relational database modal, cardinality is termed as the number of attribute.

b. A database transaction is a logical unit of database operations that must be entirely completed or entirely abandoned.

c. Database security is the mechanism that protects the database against intentional or accidental threats.

d. A candidate key is a set of one or more attributes that can uniquely identify a record in a relation.

e. A relation is in second normal form if every non-prime attribute is fully functionally dependent on every candidate key.


SECTION B: (60 MARKS)

Attempt THREE (3) out of FOUR (4) questions to this section

Question Five

A database is to be developed that will support the university of Dodoma library in managing books and borrowers. Carefully read the information provided and use it to answer questions that follow.

The library provides books to borrowers. Each book is described by title, edition, and year of publication, and is uniquely identified using the ISBN. Each borrower is described by his or her name and address and is uniquely identified using a borrower number. The library provides one or more copies of each book and each copy is uniquely identified using a copy number, status indicating if the book is available for loan, and the allowable loan period for a given copy. A borrower may loan one or many books, and the date each book is loaned out and is returned is recorded. Loan number uniquely identifies each book loan.

a. Design an entity-relationship diagram that captures the above requirements stated.
(6 Marks)

b. Based on the ERD in (a), develop a corresponding relational database schema, list tables with their attributes. For each table indicate the attribute(s) that makes a primary key also indicates foreign key whenever possible.
(6 Marks)

c. Choose only two tables from logical schema in (b) and create two data dictionaries.
(4 Marks)

d. From the data dictionaries in (c) create two physical schemas. Be certain to indicate entity integrity, referential integrity and domain integrity whenever possible.
(4 Marks)


Question Six

Consider the following relational schema. An employee can work in more than one department; the pct_time field of the Works relation shows the percentage of time that a given employee works in a given department.
Emp(eid: Int, ename: varchar(40), DoB: Int, salary: float)
Works(eid: Int, did: Int, pct_time: Int)
Dep(did: Int, dname: varchar(40), budget: float, managereid: int)

Using SQL answer the following questions:

a. Add a column eAddress with the data type varchar and size 30 in the schema Emp.
(2 Marks)

b. Modify the data type of column DoB in schema Emp from int to date.
(2 Marks)

c. Write a query to display employee names who are working in the department with did 10.
(2 Marks)

d. Give all employees with salary less than 500,000 shillings a 10 percent raise to their salary.
(3 Marks)

e. Write a query to display the names of employees who are managers along with the departments they are managing.
(3 Marks)

f. Print the name of employee whose salary exceeds the budget of all of the departments that he or she works in.
(4 Marks)

g. Find the managers who manage only departments with budgets greater than 1,000,000 shillings, but at least one department with budget less than 5,000,000.
(4 Marks)


Question Seven

a. Briefly explain the main goal of database normalization when design the database.
(3 Marks)

b. Differentiate the following:
i. First Database Normal form (1NF) and second Database Normal form (2NF).
(3 Marks)

ii. Second Database Normal form (2NF) and Third Database Normal form (3NF) if Insertion manually and Update normally.
(3 Marks)

c. An engineering consultancy firm supplies temporary specialized staff to higher companies in the country to work on their project for certain amount of time. The Table 1 lists the time spent by each of its company’s employees at other companies to carry out projects. The National Insurance Number (NIN) is unique for every member of staff.

Table 1. Time Spent by Employee

NINContrast No.HoursEmployer NameCompany IDCompany Location
616681IBSC1025172P. WhiteSC115BeiEan
674315ASC102548R. PressSC114BeiEan
322111BSC102624P. SmithSC23Bieger
616681BSC102624P. WhiteSC23Bieger

i. Find the Primary Key (PK) for this relation and explain your choice.
(3 Marks)

ii. Find fully functional dependencies on the PK and the partial functional dependencies on the PK.
(4 Marks)

iii. Normalize the table to 2NF.
(4 Marks)


Question Eight

a. Database design is an important phase in Database Development Life Cycle (DBDLC). Imagine you are working in project to develop a database for BMH hospital. Being a part of the project start-up team, your manger has asked you to prepare a work plan that will identify the phases of the database design and include the following information for each phase.
(12 Marks)

b. Assume another team leader for the BMH hospital database has brought the following schema that need to be implemented in RDBMS.

Patient (patientNo, paiName, paid\dab’, DnB, Gender)
Ward (wardNo, wardName, wardType, mOjBedu)
Contains (patientNo, wardNo, admissionDate)
Drug (drugNo, drugName, costPortUnit)
Prescribed(patientNo,drugNo,unitPartDoy,wariDate,finishDate)

i. Implement prescribed table such that patientNo and drugNo have the same values as in Patient and Drug tables. Also ensures that when system administrator will modify either patientNo or drugNo or both the values should be reflected on prescribed table and when the administrator will try to delete patientNo or drugNo values in their parent tables the operation should fail. Lastly, ensure that the unit per day ranges from 1 to 3.
(5 Marks)


ii. Implement Ward table such that the following SQL error will occurred Violation of UNIQUE KEY constraint ‘UQ_Ward_5E5082657C5C2E0C’. Cannot insert duplicate key in object ‘dbo.Ward’, when user will try to insert the following records on ward table:- (‘WOI’, ‘Male Ward’, ‘Private’, 12) and (‘WO2’, ‘Male Ward’, ‘General’, 20).
(3 Marks)


END OF EXAMINATION PAPER