You are on page 1of 10

Database Management System: Assignment 4

Total Marks : 20

September 2, 2018

Question 1
Consider the following functional dependencies Marks: 2 MSQ

AB → C
C → D
BD → E

for a relation R(A,B,C,D,E).

Which of the following set of attributes functionally determine E?

a) ACD

b) BCD

c) AB

d) CD

Answer: b), c)
Explanation: a) closure of ACD = ACD hence ACD does not determines E. b) closure of BCD
= BCDE. c) closure of AB = ABCDE. d) closure of CD = CD.
AB closure step by step:
Attributes Added in Closure FD
{AB} Triviality
{ABC} AB→ C
{ABCD} C→ D
{ABCDE} BD→ E

1
Question 2
Consider relation r1 Marks:2 MSQ

with the functional dependencies that hold on it.

• r1(p, q, r, s, t)

• p → q,r,s,t

• s→t

The relation r1 is transformed to two relations r1 a and r1 b

• r1 a(p, q, r, s)

• r1 b(s,t)

Identify the correct statement/s based on this transformation:

a) Relation r1 is in Boyce Codd Normal Form (BCNF)

b) Relation r1 a is in Third Normal Form (3NF)

c) Relation r1 b is in Boyce Codd Normal Form (BCNF)

d) Relation r1 is in Third Normal Form (3NF)

Answer: b), c)
Explanation: A relation schema R is in Boyce Codd Normal Form (BCNF) with respect to
a set F of functional dependencies if for all functional dependencies in F + of the form α → β,
where α, β ⊆ R at least one of the following holds:

1. α → β is trivial (β ⊆ α)

2. α is a superkey for R

A relation schema R is in Third Normal Form (3NF) with respect to a set F of functional
dependencies if for all functional dependencies in F + of the form α → β, where α, β ⊆ R at
least one of the following holds:

1. α → β is trivial (β ⊆ α)

2. α is a superkey for R

3. Each attribute A in β − α is contained in a candidate key for R

For r1, s → t violates BCNF. Hence, (a) is incorrect.


For r1 a, p → q,r,s is the only FD and p is the key. Hence, (b) is correct. Actually, r1 a
is in BCNF.
For r1 b, s → t is the only FD and s is the key. Hence, (c) is correct.
For r1, s → t violates 3NF as t − s = t is not contained in the key p. Hence, (d) is
incorrect.

2
Question 3
Consider the set of functional dependencies:

F={
P → QR
Q → R
P → Q
PQ → R
}

Identify the correct canonical cover for the above given set. Marks: 2 MCQ

a) { P → QR; Q → R; P → Q; }

b) { P → Q; Q → R; }

c) { P → QR; PQ → R; P → Q; Q → R }

d) { P → QR; }

Answer: b)
Explanation: A canonical cover must cover the FDs and be minimal. (d) fails Q → R. It is
easy to see that the rest 3 covers F. (b) is the minimal and hence the answer.

We can also workout by computing the canonical cover:

• There are two functional dependencies with the same set of attributes on the left:
P → QR
P → Q
These two can be combined to get P → QR.
Now, the revised set F becomes:
F= {P → QR, Q → R, PQ → R }

• There is an extraneous attribute in PQ → R because even after removing PQ → R from


the set F, we get the same closures. This is because Q → R is already a part of F. Now,
the revised set F becomes:
F= {P → QR, Q → R }

• R is an extraneous attribute in P → QR, also P → R is logically implied by P → Q and


Q → R (by transitivity). F= { P → Q, Q → R }

3
Question 4
Consider the following relational table R: Marks: 2 MSQ

R
X Y Z V W
x1 y1 z1 v1 w1
x2 y2 z1 v2 w2

Also, consider the decomposition of the relation R into R1 = (X, Y, Z) and R2 = (Z, V, W ).
Choose the correct statement/s based on the above relations.

a) The decomposition does not preserve dependencies

X Y Z V W
x1 y1 z1 v1 w1
b) ΠR1 (r) ./ ΠR2 (r) will be:
x2 y2 z1 v2 w2

c) ΠR1 (r) ./ ΠR2 (r) 6= r

d) XY → W holds in the table ΠR1 (r) ./ ΠR2 (r)

Answer: a), c)
Explanation: Let us start with computing the join:

X Y Z V W
x1 y1 z1 v1 w1
x1 y1 z1 v2 w2
ΠR1 (r) ./ ΠR2 (r) =
x2 y2 z1 v1 w1
x2 y2 z1 v2 w2

Clearly, (b) is incorrect.

Also, ΠR1 (r) ./ ΠR2 (r) 6= r (the decomposition is lossy). (c) is correct.

From the above table we can see that XY does not uniquely identify W (first two records). (d)
fails.

However, XY → W trivially holds in r. Hence, (a) is correct.

4
Question 5
Consider the table below: Marks: 2 MCQ

employee
name emp id department

Piyush E-123 Finance


Piyush E-456 HR

The relation employee is decomposed into two new relations

employee name and employee department

employee name
emp id name

E-123 Piyush
E-456 Piyush

employee department
emp id department

E-123 Finance
E-456 HR

Identify the correct characteristics of this decomposition (as observed from the given instance).

a) lossy but dependency preserving

b) lossless and dependency preserving

c) lossless but not dependency preserving

d) lossy and not dependency preserving

Answer: b)
Explanation: Apparently no dependency holds on employee. Hence, the decomposition is
trivially dependency preserving and (c) & (d) are incorrect.

In a lossy decomposition, no spurious tuple is generated when a natural join is applied to the
relations in the decomposition. Here, employee name ./ employee department = employee

employee name ./ employee department


name emp id department

Piyush E-123 Finance


Piyush E-456 HR

Hence, (b) is correct and (a) is wrong.

5
Question 6
Consider the relation R(X,Y,Z,V,W) which satisfies the following functional dependencies:

Marks: 2 MCQ
XY → Z
YZ → V
ZV → W
VW → X
XW → Y

Which of the following functional dependencies are also guaranteed to be satisfied by relation
R?

a) XZ → V

b) YZV → X

c) Z → W

d) X → Z

Answer: b)
Explanation: a) closure of XZ = XZ does not contains V. b) closure of YZV = XYZVW con-
tains X, therefore the option is correct. c) closure of Z = Z does not contains W. d) closure of
X = X does not contains Z.

Refer Module 17 slide 21

6
Question 7
Consider following relation.

R
customer id loan number customer city
99-123 23/24 Rye/Manchester
15-106 93 Horseneck
Identify if any multivalued dependency exist in relation R. Marks: 2 MCQ

a) customer city →→ customer id

b) customer id →→ loan number


customer id →→ customer city

c) loan number →→ customer id


loan number →→ customer city

d) loan number →→ customer id


customer city →→ customer id

Answer: b)
Explanation: A customer’s city is independent of the loan that they borrow. After convert-
ing the above relation in Single Valued Attribute, each of a customer’s loan appears with each
of the city they live.

R
customer id loan number customer city
99-123 23 Rye
99-123 23 Manchester
99-123 24 Rye
99-123 24 Manchester
15-106 93 Horseneck

7
Question 8
Consider the smart phone table and the functional dependencies on it. Marks:2 MCQ

• smart phone(name, model, manufacturer, battery)

• FD1: model → name

• FD2: model → manufacturer, battery

• FD3: model, manufacturer → battery

Identify the incorrect statement related to the relation smart phone.

a) smart phone is in Second Normal Form

b) smart phone is in Third Normal Form

c) smart phone cannot be normalized due to FD3

d) smart phone is in First Normal Form

Answer: c)
Explanation: In FD3: model, manufacturer → battery, the non prime attribute is de-
pendent on a super key. Also there is no transitive dependency and not composite attribute,
hence the relation is in first, second and third normal form.

The canonical cover for the set of FDs is FD1 and FD2 (covers FD3), and model is its key.
Hence, smart phone is in BCNF which means it is also in 1NF, 2NF, and 3NF.

8
Question 9
Let S(A, B, C, D) be a relational schema with the following functional dependencies:

{ A → B, B→ C, C → D, D→ B }.

A, B, C, D all are key attributes.

Relation S is decomposed into S1(A, B), S2(B, C), S3(B, D)

Identify the correct statement based on this decomposition. Marks: 2 MCQ

a) Gives a lossless join, and is dependency preserving

b) Gives a lossless join, but is not dependency preserving

c) Does not give a lossless join, but is dependency preserving

d) Does not give a lossless join and is not dependency preserving

Answer: a)
Explanation:

• Lossless-Join Decomposition: Decomposition of R into R1 and R2 is a lossless-join decom-


position if at least one of the following functional dependencies are in F+ (Closure of
functional dependencies)
R1 ∩ R2 → R1 OR R1 ∩ R2 → R2

• Dependency Preserving Decomposition: Decomposition of R into R1 and R2 is a depen-


dency preserving decomposition if closure of functional dependencies after decomposition
is same as closure of of FDs before decomposition.

Note that A, B, C and D are all key attributes. We can derive all attributes from every at-
tribute.

Since the intersection of all decomposed relations (S1, S2 and S3) is B and B derives all other
attributes, decomposition is lossless.

The decomposition is dependency preserving as well as all functional dependencies are pre-
served directly or indirectly. Note that C → D is also preserved from C → B (in S2) and B →
D (in S3).

9
Question 10
Consider the following instance of a relational schema R(A, B, C).

A B C
5 5 5
5 5 1
7 9 7
7 9 7

Identify the correct statement(s) based on the above instance of relational schema R.

Marks: 2 MCQ

a) A functionally determines B and B functionally determines C

b) A functionally determines C and B does not functionally determine C

c) B does not functionally determine C

d) A does not functionally determine B and B functionally determines C

Answer: c)
Explanation: A → B holds true for the above instance. We can be sure that B does not
functionally determine C because for the value 5 of B, it gives two different values of C i.e.
5 and 1. From the above instance it is concluded that A does not functionally determine C
because for A = 5 there are two values of C.

10

You might also like