0% found this document useful (0 votes)
52 views6 pages

Final Term Exam Spring 2020

The document contains a final exam for a database systems theory course taken by student Abubakar in the 4th semester. It includes 6 multiple choice questions testing concepts like database normalization, functional dependencies, and identifying anomalies in database tables. The exam contains the student's answers explaining concepts like how many relations would be created from a superclass with 3 subclasses, which statements about subclasses are false, and identifying and resolving issues like insertion and deletion anomalies and transitive dependencies in sample database tables.

Uploaded by

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

Final Term Exam Spring 2020

The document contains a final exam for a database systems theory course taken by student Abubakar in the 4th semester. It includes 6 multiple choice questions testing concepts like database normalization, functional dependencies, and identifying anomalies in database tables. The exam contains the student's answers explaining concepts like how many relations would be created from a superclass with 3 subclasses, which statements about subclasses are false, and identifying and resolving issues like insertion and deletion anomalies and transitive dependencies in sample database tables.

Uploaded by

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

FINAL TERM EXAM SPRING 2020

Name Abubakar
ID 9616
Section D
Subject Database System (Theory)
Submitted To Ma’am Maryam Khan
Semester 4th
=====================================================================================
Q1: If there is one super type and three subtypes, then how many relations should be created?

Ans: If there is one super type and three subtypes, FOUR relations can be created.

=====================================================================================

Q2: Which of the following statements is/are false regarding subtype entities?

i) Subtypes may be exclusive.


ii) The supertype and subtypes will have the same identifier.
iii) Each supertype has a relationship with the subtype.
iv) All of the above statements are false.

Ans: Each supertype has a relationship with subtype.

=====================================================================================

Q3: Answer the following question (I to II) by assuming the following scenario for table named as
INSTRUCTOR with attributes STUDENT, DEPARTMENT and PROFESSOR.

I) Considering the above scenario, which of the functional dependencies exist in INSTRUCTOR table?

i. Department  Professor
ii. Student  Professor
iii. Department  Professor Student
iv. Professor  Department
v. Professor  Student

Ans: Professor  Department

II) Choose the one which is not the candidate key of table INSTRUCTOR?

i) (Department, Student)
ii) (Department, Professor)
iii) (Department, Student, Professor)
iv) All of above

Ans: Department , Professor

=====================================================================================
Q4: Consider the following Table 1 with the given scenario and answer the below question.

The scenario is: “A patient receives an appointment at a particular date and time with dentist doing a
specific surgery. On each day of patient appointments, a dentist is allocated to a specific surgery for that
day. “

(a) Write the insertion and deletion anomalies present in Table 1

staffNo dentistName patNo patName Appointment surgeryNo


date time
S1011 Tony Smith P100 Gillian White 12-Sept-04 10:00 S15

S1011 Tony Smith P105 Jill Bell 12-Sept-04 12:00 S15

S1024 Helen Pearson P108 Lan MacKay 12-Sept-04 10:00 S10

S1024 Helen Pearson P108 Lan MacKay 14-Sept-04 14:00 S10

S1032 Robin Plevin P105 Jill Bell 14-Sept-04 16:30 S15

S1032 Robin Plevin P110 John Walker 15-Sept-04 18:00 S13

ANSWER:

This table is not well structured, un-normalized containing redundant data. If we observe the above
table we will see the multiple values in appointment columns and which violates the INF, there are
many anomalies exist. We will discuss two anomalies which is given below:

1) INSERTION ANOMALIES:

If we insert a new patient record that makes and appointment with designated Doctor,
we would need to enter the correct data. If we insert the details for new patient in (patNo,
patName and Appointment) we would must enter the specific details of doctor. So, that the
patient details are compatible with values for the designated Doctor.

EXAMPLE:

S1011, To enter new patient data that doesn’t have Doctor to be assigned we can’t
insert NULL values for the primary key.

2) DELETION ANOMALIES:

If we want to delete a patient named Jill Bell so two records will be deleted from the
table i.e from row 2 and 5. This anomaly also obvious when we want to delete the dentistName,
multiple records need to deleted to maintain the data integrity. If we want to delete doctor
details his patients record will also be remove from the database.

=====================================================================================
Q5: Consider the following Table.

a) Identify where the partial dependency exists.


b) Convert the table into 2NF.

Teacher ID Teacher Subject Teacher Age


111 C++ 40
112 OOP 43
111 Database 40
123 Java 42
123 Computer Network 42
ANSWER:

a) PARTIAL DEPENDENCIES:

Those non-key attributes which are fully functional dependent on primary key.

OR

When a non-prime attribute is functionally dependent on part of a candidate key.

REASON:

Partial dependency is that where an attribute in a table depends on only a part of the
primary key.

EXPLAIN THROUGH ABOVE GIVEN TABLE:

The column Teacher Subject is only row dependent on Teacher ID, where Teacher ID is
uniquely connected to Teacher Subject. Hence, there is no connection of Teacher Subject with Teacher
Age. Therefore, Partial Dependency occur in between Teacher ID and Teacher Subject.

------------------------------------------------------------------------------------------------------------------------------------------

b) CONVERT THE TABLE INTO 2NF.

As from the above table we know that non-prime attribute Teacher ID depends on
Teacher Age which is a proper subset of a candidate key, which violates the rules of 2NF.

To convert the table into 2NF, we break down the table into two parts.

Teacher ID Teacher Age


111 40
112 43
123 42
Teacher ID Teacher Subject
111 C++
112 OOP
111 Database
123 Java
123 Computer Network
=====================================================================================

Q6: The table shown in the below figure displays the information related to books, their categories and
prices.

a) Identify the transitive dependency exists.


b) Convert the table into 3NF

Book-ID Category-ID Category-Type Price


1 1 Hobbies 10$
2 2 Sports 40$
3 1 Hobbies 80$
4 3 History 30$
5 2 Sports 10$

ANSWER:

a) TRANSITIVE DEPENDENCY:

The table will be transitive dependency if it follows the following relationships:

X is functionally dependent on Y, and Y is functionally dependent on Z. in the above


table, Z is reliant transitively on X through Y.

There is no Transitive Dependency.

In the above table, Book-ID determines Category-id, and Category-ID determines


Category-Type. Therefore, Book-ID determines Category-Type via Category-ID and we have
transitive functional dependency, and this structure does not satisfy third normal form.

------------------------------------------------------------------------------------------------------------------------------------------
b) CONVERT THE TABLE INTO 3NF:

Book-ID Category-ID Category-Type Price


1 1 Hobbies 10$
2 2 Sports 40$
3 1 Hobbies 80$
4 3 History 30$
5 2 Sports 10$

To convert the table into 3NF we will break down the table into two tables which is given below:

1) TABLE BOOK:

Book-ID Category-ID Price


1 1 10$
2 2 40$
3 1 80$
4 3 30$
5 2 10$

2) TABLE CATEGORY:

Category-ID Category-Type
1 Hobbies
2 Sports
1 Hobbies
3 History
2 Sports
=====================================================================================

Q7: Convert the following ER Diagram into Relational Model. (Ignore relationship attributes and derived
attributes while converting to Relational Model).

ANSWER:
ON NEXT PAGE
Company

Company-Id Company-Name

Staff
Foreign key

Staff-id Name D.O.Birth Address Company-Id


Task

Task-Id Task-Description

Wife
Staff-Id Wife-Name

Child Foreign key

Child-ID Child-Name Staff-Id

Phone

Foreign key

World-Id Company-Id Staff-Id

Perform
Foreign key

Phone-id Phone-number Staff-id

Foreign key Foreign key

Perform-id Staff-id Task-id

=====================================================================================

You might also like