FD's & Normalization - DPP 07 (Extra DPP) 2
FD's & Normalization - DPP 07 (Extra DPP) 2
[MCQ]
1. Consider the following two relational schemas [MCQ]
Schema 1: R (P, Q, R, S) 4. Consider the following statements
Schema 2: R1(P, Q, R) R2(Q, S) and the following S1: If the proper subset of candidate key determines
statements. non-prime attribute, then it is violation case of
S1: If the only functional dependencies that hold on 2NF.
the relation in the schema 1 are P → Q, R → S, S2: If P→Q and Q→R are two FD’s then P→Q is
then relation R is in BCNF. known as transitive dependency
S2: If the only FD that hold on the relation in the Which of the statements are/is true?
schema 2 are P→Q, P→R, Q→P, P→S then the (a) Only S1 (b) Only S2
relation R1 and R2 are in BCNF. (c) Both S1 and S2 (c) Neither S1 nor S2
Which of the following statements are true?
(a) Only S1 is true [MCQ]
(b) Only S2 is true. 5. Consider the following statements about Boyce – Codd
(c) Both S1 & S2 are true Normal Form (BCNF)
(d) Neither S1 nor S2 are true S1: The determinant for each functional dependency
must be a super key.
[MCQ] S2: Transitive dependencies does not result in
2. Assume that a relation is in 3NF under which of the abnormalities in a relation in BCNF.
following conditions R can violate BCNF? (a) Only S1 is true
(a) The table consists two candidate keys that share a (b) Only S2 is true
common attribute. (c) Both S1 and S2 are true
(b) The table consists of two non-overlapping (d) Neither S1 nor S2 is true
candidate keys.
(c) The table has a unique candidate key consisting of [MCQ]
one attribute. 6. Consider a table/Relation R has one candidate key, then
(d) The table consists of two candidate keys each which of the following is always true?
consisting of one attribute. (a) If R is in 2NF, then it is also in 3NF
(b) If R is in 3NF, then it is also in BCNF
[MCQ] (c) If R is in 2NF, but it is not in 3NF
3. Consider a relation R(P, Q, R, S, T, U, V, W) with the (d) None of the above.
following functional dependencies:
{RW→V, P→QR, Q→RUW, T→P, U→TV}, then the [MSQ]
relation R is in _______. 7. Let’s suppose, dependencies have to be preserved and
(a) 1NF (b) 2NF BCNF decomposition is not possible. Which of the
(c) 3NF (d) BCNF following normal forms can be still achievable (while
preserving dependencies)?
(a) 1NF (b) 2NF
(c) 3NF (d) 4NF
2
[MCQ]
8. Consider a relation R(P, Q, R, S, T) with the set of FD’s
{PQR→ ST and T → QRS} which of the following
statements is true?
(a) R is not in 2NF
(b) R is in 2NF but not in 3NF
(c) R is in 3NF but not in BCNF
(d) R is in BCNF
3
Answer Key
1. (b) 5. (c)
2. (a) 6. (b)
3. (a) 7. (a, b, c)
4. (a) 8. (a)
4
4. (a)
P→Q and Q→R are two FD’s then P→R is known as
transitive dependency, hence S2 is false.
5. (c)
i i n DPP 01
[NAT] [MSQ]
4. Consider the below relation schema Stud (Rid, name, 8. Choose the correct statement from the following.
course, mail, phone) with FD set as: (a) The cardinality is defined as the number of
Rid → {Rid} attributes in a relation.
Rid → {name, mail} (b) Degree of the relation is the number of tuples in
the relation.
course → {course, phone}
2
(c) Relation instance is the set of tuples of a relation (d) All of the above
at a particular instance of time.
Answer Key
1. (a, b) 5. (c)
2. (1) 6. (c)
3. (c) 7. (b)
4. (3) 8. (c)
3
[MSQ] [MCQ]
1. Choose the correct statement from the following: 5. Choose the incorrect statement from the following
(a) There can be many primary keys for a relation. (a) All super keys cannot be primary key.
(b) There can be many alternate keys for a relation. (b) We choose the minimal candidate key to be a
(c) All the candidate keys are also super keys. primary key.
(d) All the super keys are also the candidate keys. (c) The number of super keys are equal to the number
of primary keys for a relation.
[NAT] (d) None of the above.
2. Consider the below instance of relation:
Employee: [NAT]
Emp_rating Emp_name Emp_mail Emp_sal 6. Suppose a relation R has 9 attributes, then the
1 Rohit p@pw 40000 maximum possible number of candidate keys are?
2 Kanika c@pw 60000
1 Rohit Null 50000 [MSQ]
3 Pankaj g@pw 60000 7. For all given set of FD’s find the primary key from
The maximum possible number of alternate keys for the options below, for relation R (A, B, C, D, E, F)
the above relational instance is/are _____. {A → D, C → BDE, B → F, B → C}
(a) AC could be the primary key.
[MCQ] (b) There are two candidate keys AC and AB.
3. Consider the set of functional dependencies for a (c) BC is the primary key.
relation R(D, N, C, S) (d) No primary key exists for the relation.
{D→N, D→C, D→S, C→S}
Then choose the correct statement regarding the above [MCQ]
set. 8. Consider a relation R (A B C D E F), on this relation
(a) {D} is the superkey for the relation. how many maximum number of candidate keys are
(b) {DN} is the candidate key for the relation. possible?
(c) {DC} is the candidate key for the relation. (a) 8 (b) 12
(d) {CN} is the superkey for the relation. (c) 16 (d) 20
[NAT]
4. Consider the given FD set for relation
R (X, Y, Z, W, U, V)
{X → Y, YZ → W, U → Z, W → X}
Then the number of prime attributes for the relation
are?
3
Answer Key
1. (b, c) 5. (c)
2. (3) 6. (126)
3. (a) 7. (a, b)
4. (5) 8. (d)
4
[MCQ] B→D
1. Consider the relation R (P, Q, R, S, T) and the set of E→A
function dependencies F = {P →Q, QR →T, TS→P}. Which of the following functional dependencies is
Which of the following is not the candidate key of R? implied by the above set?
(a) RST (b) PRS (a) CD→AC (b) BC→CD
(c) QRS (d) PQR (c) AC→BC (d) BD→CD
[NAT] [MCQ]
2. Assume a relation R (P, Q, R, S, T) with the set of 6. Assume the relation R that has eight attributes
functional dependencies {P→Q, Q→R, R→Q and ABCDEFGH. Let A = {CH→G, A→BC, B→CFH,
Q→T}. how many candidate keys are possible in R? E→A, F→EG} is a set of functional dependencies
(FD). How many candidates key does the relation R
[MCQ] have?
3. Consider the following statements: (a) 2 (b) 3
S1: A key in DBMS is an attribute (or) a set of (c) 4 (d) 5
attributes that help to uniquely identify a tuple (or
row) in a relation (or table). [MCQ]
S2: There should be only one candidate key in 7. Assume the relation schema R(P, Q, R, S, T, U, V, W,
relation, which is chosen as the primary key. X, Y, Z) and the set of functional dependencies on R:
(a) Only S1 is true. F = {PQ→R, Q→UV, PT→WX, W→Y, X→Z}.
(b) Only S2 is true. Which of the following can be candidate key for R?
(c) Both S1 and S2 are true. (a) PQU (b) PQT
(d) Neither S1 nor S2 is true. (b) PQTR (d) PQTWX
[MSQ] [MCQ]
4. Choose the correct statements from the following: 8. Consider the following statements:
(a) The minimal set of attributes that can uniquely S1: Primary key has no duplicate values it has only
identify tuple is known as a candidate key. unique values.
(b) A super key is a group of single or multiple keys S2: Primary key are not necessary to be a single
that identifies rows in a table. It supports NULL column more than one column can also be a
values. primary key for table.
(c) Primary key is not a unique key. (a) Only S1 is true.
(d) None of the above. (b) Only S2 is true.
(c) Both S1 & S2 are true.
[MSQ] (d) Neither S1 nor S2 are true.
5. Consider a schema with attributes A, B, C, D & E
following set of functional dependencies are given,
A→B
A→C
CD→E
2
[MSQ]
9. Choose the correct statements about candidate key.
(a) Candidate key is a super key with maximum
attributes.
(b) It must contain unique values.
(c) A table can have multiple CK’s but only one
primary key.
(d) It is a super key with no repeated data which is
called a candidate key.
3
Answer Key
1. (d) 6. (c)
2. (1) 7. (b)
3. (a) 8. (c)
4. (a, b) 9. (b, c, d)
5. (a, b, c)
4
7. (b)
Example: Passport_No, Employee_ID, Roll_No
Simply find the closure of all the options given, as we
(b) Super key: super key is an attribute (or set of
can see PQT cannot be derived from any of the above
attributes) that is used to uniquely identify all
FDS which states that P, Q & T must be present in the
attributes in a relation.
key. Hence, we need to verify only b, c & d by taking
Note: The difference between superkey and a closure set PQT+ derives all attributes in relation R. so
primary key is as follows: it is candidate key.
(i) Super key’s attributes can contain NULL. NOTE: option (c) & (d) are the super keys, since
(ii) Primary key is a minimal super key hence all adding zero or more attributes to C.K generates super
super keys can’t be primary key. key.
[MCQ]
1. Consider the following two sets of functional [NAT]
dependencies 5. Let a relation R have attributes {P, Q, R, S, T} and
X = {P→Q, Q→R, R→P, P→R, R→Q, Q→P} “PQR” is the candidate key, then how many super keys
Y = {P→Q, Q→R, R→P} are possible ________?
Which of the following is true?
(a) X Y (b) Y X [MCQ]
(c) X Y (c) X Y 6. Consider the following FD sets:
S1 = {P→R, PR→S, T→PS, T→U}
[NAT] S2 = {P→S, QR→PS, R→Q, T→P, T→S, T→U}
2. Consider a relation with schema R(P, Q, R, S, T) and S3 = {P→S, R→P, R→Q, T→PU}
FD set (PQ→R, R→S, S→P). How many super keys Which of the following sets is equivalent?
in relation R contains?____. (a) S1 S2 (b) S2 S3
(c) S1 S3 (d) S1 S2 S3
[NAT]
3. Consider a relation R(P, Q, R, S, T) with the set of [NAT]
functional dependencies {P→QR, RS→T, Q→S, and 7. Consider a relation R = {P, Q, R, S, T, U, V, W} with
T→P}. How many super keys are possible in R? the functional dependency sets S = {PR→V, S→TV,
_____. QR→S, RV→QS, PRS→Q, RT→PV}
The minimum numbers of simple functional
[MCQ] dependency in the minimal cover of F is _________?
4. Consider the relation schema R(P, Q, R, S, T, U, V, W,
X, Y) and the set of functional dependencies on R are: [NAT]
F = {PQ→R, Q→TU, PS→VW, V→X, W→Y}. 8. Consider a relation R(P, Q, R, S, T) with the following
Which of the following can be the candidate key for R? functional dependencies: PQR→ST and S→PQ, then
(a) PQT (b) PQS the number of super keys in R is_______?
(c) PQSR (d) PQSVW
2
Answer Key
1. (c) 5. (4)
2. (7) 6. (b)
3. (27) 7. (6)
4. (b) 8. (10)
3
2. (7)
6. (b)
Candidate keys: PQT, QST, QRT
Super keys: Candidate key for S1 = T, closure of T+ = {P, Q, R, S,
PQT: PQT, PQRT, PQST, PQRST T, U}
QST: QST, PQST, QRST, PQRST Candidate key for S2 = RT closure of RT+ = {P, Q, R,
QRT: QRT, PQRT, QRST, PQRST S, T, U}
Total distinct super keys are PQT, QST, QRT, PQRT, Candidate key for S3 = RT closure of RT+ = {P, Q, R,
PQST, QRST, PQRST. Therefore, correct answer is 7.
S, T, U}
So, S2 as S3 are equivalent.
3. (27)
P→QR
7. (6)
RS→T
A FD A→B is a simple FD if B is a single attribute:
Q→S
Step 1:
T→P
Simplify all the given FD’s
Candidate key {P, RS, QR, T}
PR→V
{P}+ = {P Q R S T}
{T}+ = {P Q R S T} S→T
{RS}+ = {P Q R S T} S→V
{QR}+ = {Q R S T P} QR→S
So total super key on R for 5 attributes is 25 – 1 = 31 RV→S
Q, R, S and QS are not super keys RV→Q
31 – 4 = 27 PRS→Q
Hence there are 27 super keys.
RT→P
RT→V
4. (b)
Step 2:
firstly, find the closure of all the options given above.
As we can see that P, Q, and S cannot be derived from Find out extraneous attributes present in FD.
any of the above functional dependencies given which PRS → Q: (PR)+ → PRVQ, So we get Q, S is
states that P, Q and S should be present in the key. extraneous and can be safely removed, rewriting the
Therefore, we need to check only the closure set of new FD as PR→Q.
option b, c and d which contains these three. Since PR→V: P+→P, so can’t get V; R is not extraneous,
PQS+ derives all the attributes in the relation R, So R+→ R, so, count set V; P is not extraneous. Hence,
clearly, it’s a candidate key. keep this FD as it is.
4
Answer Key
1. (c) 5. (d)
2. (d) 6. (c)
3. (d) 7. (c)
4. (d) 8. (d)
4
(PQ)+ = PQR but (F1 F2)+ will not contain R. So this 4. (d)
is not dependency preserving. {P Q, P R, P S, PT W, T S, T U}
S2 : P Q R S T U V W
P Q R S T U R1
R1 R2
R2
PT W is not preserved
R3 Therefore, its neither dependency preserving not
R4 lossless
3. (d)
Neither lossless nor dependency preserving
A decomposition is lossy if after joining, relation
(d) is correct option.
contains extra tuple, divide the table according to
5
[MCQ] [MSQ]
1. Assume a relation R(P, Q, R, S, T) with the following 5. Consider the following relation R(P, Q, R, S) and
functional dependencies functional dependencies F that hold over the relation
{PQ → RST, P → R, Q → S}. which of the following F = {P → QS, RS → Q, R → S, Q → PS}. The relation
decomposition of R satisfies BCNF? R is in which of the following normal form?
(a) R1 (P, R), R2(Q, S), R3(P, Q, R, S, T) (a) 1NF (b) 2NF
(b) R1(P, R), R2(Q, S), R3(P, Q, R, T) (c) 3NF (d) BCNF
(c) R1(P, R), R2(Q, S), R3(P, Q, S, T)
(c) R1(P, R), R2(Q, S), R3(P, Q, T) [MCQ]
6. Consider a relation which contains two different true
[MCQ] multivalued dependencies then which of the following
2. Assume a relation R = (P, Q, R, S) and a set F of normal form is violated automatically.
functional dependencies: (a) 2NF (b) 3NF
F = {PR → S, S → P, S → Q, S → R}, Highest normal (c) BCNF (d) 4 NF
form satisfied by the relation R is?
(a) 2NF (b) 3NF [MCQ]
(c) BCNF (d) 1NF 7. Assume a relation R(P, Q, R, S, T, U) with the
following dependencies
[MCQ] 1. PQ → RS 2. T → R 3. Q → TU
3. Assume the relation R(P, Q, R, S, T) with candidate Given the functional dependencies as shown above
key PQ is in atleast 3NF. which of the following which among the options shows the decomposition of
functional dependencies given in option are invalid? relation R is normalized to 3NF?
(a) R1(P, Q, R, S, T, U) R2(T, R) R3(Q, T, U)
(a) PQ → R (b) ST → Q
(c) PQ → S (d) RS → T (b) R1(P, Q, R, S) R2(R, T) R3(T, U, Q)
(c) R1(P, Q, R, S) R2(R, T) R3(Q, T, U)
[MSQ]
(d) R1(P, Q, S), R2(T, R) R3(Q, T, U)
4. State which of the following statements is/are true?
(a) Normal forms are used to eliminate or reduce
redundancy in database tables. [MCQ]
(b) A relation is in first normal form if every attribute 8. Given the relation ‘R’ with attributes PQRST with set
in that relation is singled valued attribute or No of functional dependencies {P → P Q R S T, Q → R}
Multivalued Attribute. which of the following is / are true?
(c) A relation is in 2NF if every candidate key is (a) R1(PRST) R2(QR) are both in BCNF and
simple candidate key. preserves lossless join.
(d) A relation R is in BCNF, if R is in 3rd normal form (b) R1(PQST), R2(QR) are both in BCNF and
and for every functional dependency, LHS is preserves lossless join
super key. A relation is in BCNF iff in eveiy non- (c) R1(PST), R2(QR) are both in BCNF and preserves
trivial functional dependency P -> Q, where P is a lossless join.
super key. (d) None of the above.
2
Answer Key
1. (d) 5. (a, b)
2. (c) 6. (d)
3. (d) 7. (d)
4. (a, b, c, d) 8. (b)
3