### Sunday, January 20, 2013

# GATE Questions - DBMS - Normalization

**Previous GATE questions with solutions on DBMS (Normalization) - CS/IT**

Normalisation is a technique for producing relational schema with no information redundancy and no anomalies (insert, update or delete anomalies)

**GATE-1998**1. Which normal form is considered adequate for normal relational database design?

(a) 2NF (b) 5NF (c) 4NF (d) 3NF

Ans: option (d)

Explanation:

A relational database table is often described as "normalized" if it is in the Third Normal Form because most of the 3NF tables are free of insertion, update, and deletion anomalies.

*GATE-2001*
2. Consider a schema R(A, B, C, D) and functional dependencies A -> B and C -> D. Then the decomposition of R into R1 (A, B) and R2(C, D) is

(a) dependency preserving and lossless join

(b) lossless join but not dependency preserving

(c) dependency preserving but not lossless join

(d) not dependency preserving and not lossless join

Ans: option (c)

Explanation:

While decomposing a relational table we must verify the following properties:

i) Dependency Preserving Property: A decomposition is said to be dependency preserving if F

For the above question R1 preserves A->B and R2 preserves C->D. Since the FDs of universal relation R is preserved by R1 and R2, the decomposition is dependency preserving.

ii) Lossless-Join Property:

The decomposition is a lossless-join decomposition of R if at least one of the following functional dependencies are in F+:-

a) R1 ∩ R2 -> R1

b) R1 ∩ R2 -> R2

It ensures that the attributes involved in the natural join ( ) are a candidate key for at least one of the two relations.In the above question schema R is decomposed into R1 (A, B) and R2(C, D), and R1 ∩ R2 is empty. So, the decomposition is not lossless.

^{+}=(F1 ∪ F2 ∪ .. Fn)^{+}, Where F^{+}=total functional dependencies(FDs) on universal relation R, F1 = set of FDs of R1, and F2 = set of FDs of R2.For the above question R1 preserves A->B and R2 preserves C->D. Since the FDs of universal relation R is preserved by R1 and R2, the decomposition is dependency preserving.

ii) Lossless-Join Property:

The decomposition is a lossless-join decomposition of R if at least one of the following functional dependencies are in F+:-

a) R1 ∩ R2 -> R1

b) R1 ∩ R2 -> R2

It ensures that the attributes involved in the natural join ( ) are a candidate key for at least one of the two relations.In the above question schema R is decomposed into R1 (A, B) and R2(C, D), and R1 ∩ R2 is empty. So, the decomposition is not lossless.

*GATE-2002*
3. Relation R with an associated set of functional dependencies, F, is decomposed into BCNF. The redundancy (arising out of functional dependencies) in the resulting set of relations is

(a) Zero

(b) More than zero but less than that of an equivalent 3NF decomposition

(c) Proportional to the size of F+

(d) Indeterminate

Ans: option (b)

Explanation:

Redundancy in BCNF is low when compared to 3NF.

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 and Î²⊆R,at least one of the following holds:

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 and Î²⊆R,at least one of the following holds:

- Î±→Î² is a trivial functional dependency (i.e. Î²⊆Î±).
- Î± is a superkey for schema R.

For more details on BCNF: CLICK HERE

*GATE-2005*4. Which one of the following statements about normal forms is FALSE?

(a) BCNF is stricter than 3NF

(b) Lossless, dependency-preserving decomposition into 3NF is always possible

(c) Lossless, dependency-preserving decomposition into BCNF is always possible

(d) Any relation with two attributes is in BCNF

Ans: option (c)

Explanation:

Achieving Lossless and dependency-preserving decomposition property into BCNF is difficult. For details: http://en.wikipedia.org/wiki/Boyce%E2%80%93Codd_normal_form#Achievability_of_BCNF

*GATE-2005 (IT)*5. A table has fields F1, F2, F3, F4, and F5, with the following functional dependencies:

F1->F3

F2->F4

(F1,F2)->F5

in terms of normalization, this table is in

(a) 1NF (b) 2NF (c) 3NF (d) None of these

Ans: option (a)

Explanation:

Since the primary key is not given we have to derive the primary key of the table. Using the closure set of attributes we get the primary key as (F1,F2). From functional dependencies, "F1->F3, F2->F4", we can see that there is partial functional dependency therefore it is not in 2NF. Hence the table is in 1NF.

*GATE-2012*
6. Which of the following is TRUE?

(a) Every relation in 2NF is also in BCNF

(b) A relation R is in 3NF if every non-prime attribute of R is fully functionally dependent on every key of R

(c) Every relation in BCNF is also in 3NF

(d) No relation can be in both BCNF and 3NF

Ans: option (c)

*GATE-2003*7. Consider the following functional dependencies in a database.

Date_of_Birth->Age Age->Eligibility

Name->Roll_number Roll_number->Name

Course_number->Course_name Course_number->Instructor

(Roll_number, Course_number)->Grade

The relation (Roll_number, Name, Date_of_birth, Age) is

(a) in second normal form but not in third normal form

(b) in third normal form but not in BCNF

(c) in BCNF

(d) in none of the above

Ans: option (d)

Explanation:

For the given relation only some of the above FDs are applicable. The applicable FDs are given below:

Date_of_Birth->Age

Name->Roll_number

Roll_number->Name

Finding the closure set of attributes we get the candidate keys:(Roll_number,Date_of_Birth), and (Name,Date_of_Birth) .

*ALGORITHM TO FIND THE CLOSURE SET: Check the explanation for question number 1: http://www.btechonline.org/2013/01/gate-questions-dbms-functional.html*

On selecting any one of the candidate key we can see that the FD Date_of_Birth->Age is a partial dependency. Hence the relation is in 1NF.

*GATE-2004*
8. The relation schema Student_Performance (name, courseNo, rollNo, grade) has the following FDs:

name,courseNo->grade

rollNo,courseNo->grade

name->rollNo

rollNo->name

The highest normal form of this relation scheme is

(a) 2NF (b) 3NF (c) BCNF (d)4NF

Ans: option (b)

Explanation:

With the help of closure set of attributes we can find the candidate keys: (name,courseNo) and (rollNo,courseNo).

*ALGORITHM TO FIND THE CLOSURE SET: Check the explanation for question number 1: http://www.btechonline.org/2013/01/gate-questions-dbms-functional.html*
A table is in 2NF if and only if it is in 1NF and no non-prime attribute is dependent on any proper subset of any candidate key of the table. A non-prime attribute of a table is an attribute that is not a part of any candidate key of the table.

name, rollNo & courseNo are known as prime attributes, because they are part of candidate keys. The only non-prime key attribute here is "grade", which is fully dependent on the keys. Hence the relation is in 2NF.

name->rollNo and rollNo->name are not partial functional dependencies, because for a functional dependency X->Y to be partially dependent, X should be prime attribute and Y should be non prime attribute. But here both X and Y are prime attributes.

name->rollNo and rollNo->name are not partial functional dependencies, because for a functional dependency X->Y to be partially dependent, X should be prime attribute and Y should be non prime attribute. But here both X and Y are prime attributes.

A

**super key**is the set of attributes which can uniquely identify a tuple. A candidate key is a superkey. Adding zero or more attributes to candidate key generates super key.
A table is in 3NF if and only if, for each of its functional dependencies X -> A, at least one of the following conditions holds:

* X contains A (that is, X -> A is trivial functional dependency), or

* X is a superkey, or

* A should be prime attribute.

First two FDs (i.e. name,courseNo->grade & rollNo,courseNo->grade) satisfies second condition. Because name,courseNo & rollNo,courseNo is a superkey. Last two FDs (i.e name->rollNo & rollNo->name) satisfies third condition because rollNo and name is a prime attribute. Therefore the relation is also in 3NF.

Note the definition of BCNF in question number 3. None of FDs satisfy first condition. That means for this relation to be in BCNF all FDs must satisfy the second condition, that is left side of all FDs should be a superkey. But below 2 FDs satisfy the second condition.

First two FDs (i.e. name,courseNo->grade & rollNo,courseNo->grade) satisfies second condition. Because name,courseNo & rollNo,courseNo is a superkey. Last two FDs (i.e name->rollNo & rollNo->name) satisfies third condition because rollNo and name is a prime attribute. Therefore the relation is also in 3NF.

Note the definition of BCNF in question number 3. None of FDs satisfy first condition. That means for this relation to be in BCNF all FDs must satisfy the second condition, that is left side of all FDs should be a superkey. But below 2 FDs satisfy the second condition.

name->rollNo , name is not a superkey

rollNo->name, roll is not a superkey

Hence not BCNF. Therefore the highest normal form of this relation scheme is 3NF.

Hence not BCNF. Therefore the highest normal form of this relation scheme is 3NF.

*GATE-2004 (IT)*
9. The relation EMPDT1 is defined with attributes empcode(unique), name, street, city, state, and pincode. For any pincode,there is only one city and state. Also, for any given street, city and state, there is just one pincode. In normalization terms EMPDT1 is a relation in

(a) 1NF only

(b) 2NF and hence also in 1NF

(c) 3NF and hence also in 2NF and 1NF

(d) BCNF and hence also in 3NF, 2NF and 1NF

Ans: option (b)

Explanation:

empcode is unique, therefore it is the primary key. Since the primary key consists of a single attribute there will be no partial dependency, hence the relation is in 2NF.

From the question we get the FDs as below:

pincode -> city, state

street,city,state -> pincode

From the FDs we can see that there are transitive dependencies, hence the table is not in 3NF.

*GATE-2007*10. Which one of the following statements if FALSE?

(a) Any relation with two attributes is in BCNF

(b) A relation in which every key has only one attribute is in 2NF

(c) A prime attribute can be transitively dependent on a key in a 3 NF relation.

(d) A prime attribute can be transitively dependent on a key in a BCNF relation.

Ans: option (d)

Explanation:

Check the explanation of question 8.

*GATE-2008*
11. Consider the following relational schemes for a library database:

Book (Title, Author, Catalog_no, Publisher, Year, Price)

Collection (Title, Author, Catalog_no)

With the following functional dependencies:

I. Title Author -> Catalog_no

II. Catalog_no -> Title Author Publisher Year

III. Publisher Title Year -> Price

Assume {Author, Title} is the key for both schemes. Which of the following statements is true?

(a) Both Book and Collection are in BCNF

(b) Both Book and Collection are in 3NF only

(c) Book is in 2NF and Collection is in 3NF

(d) Both Book and Collection are in 2NF only

Ans: option (c)

Explanation:

The relation Collection is in BCNF: Its given that {Author, Title} is the key and there is only one functional dependency (FD) applicable to the relation Collection {i.e. Title Author –> Catalog_no}.

As per the definitions of the normal forms (given in the explanation of question no. 8) Book is in 2NF.

*GATE-2008(IT)*12. Let R(A,B,C,D,E,P,G) be a relational schema in which the following FDs are known to hold:

AB->CD

DE->P

C->E

P->C

B->G

The relation schema R is

(a) in BCNF (b) in 3NF, but not in BCNF

(c) in 2NF, but not in 3NF (d) not in 2NF

Ans: option (d)

Explanation:

From the closure set of attributes we can see that the key for the relation is AB. The FD B->G is a partial dependency, hence it is not in 2NF.

*ALGORITHM TO FIND THE CLOSURE SET: Check the explanation for question number 1: http://www.btechonline.org/2013/01/gate-questions-dbms-functional.html*

*GATE-2013***Linked question (13 & 14)**

Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F={CH→G, A→BC, B→CFH, E→A, F→EG} is a set of functional dependencies (FDs) so that F + is exactly the set of FDs that hold for R.

13. How many candidate keys does the relation R have?

(a) 3 (b) 4 (c) 5 (d) 6

Ans: option (b)

Explanation:

In a relational database, a key helps to uniquely identify each record within a table . A key is a combination of one or more fields/attributes in a table. If a relational schema has multiple keys,each key is a candidate key. One of the candidate keys is chosen as the primary key.

To find the candidate keys, we need to find the closure of each attribute. (If x ia an attribute(field), set of attributes determined by x under a set F of functional dependencies is the closure of x under F, denoted x+ ).

Thus,

A+:ABCFHGE

B+: BCFHEGA

C+:C

D+:D

E+: EABCFHG

F+:FEGABCH

G+:G

H+ : H

A+,B+,E+,F+ contains all attributes except D. Thus there are 4 candidate keys DA,DB,DE and DF.

14. The relation R is

(a) in 1NF, but not in 2NF.

(b) in 2NF, but not in 3NF.

(c) in 3NF, but not in BCNF.

(d) in BCNF.

Ans: option (a)

Explanation:

An attribute that does not occur in any candidate key is called a non-prime attribute.

(Reference: https://en.wikipedia.org/wiki/Candidate_key)

Consider F->G; G is a non-prime attribute and F is a proper subset of a candidate key (refer the above question). This is a case of partial dependency. Hence 2NF condition is violated. similarly A->C and B->CH also violates 2NF condition, hence R is not in 2NF.

Since attributes of relation R has only atomic values, R is in 1NF.

*Questions 13 & 14 contributed by Radhika V.M., M.Tech, College of Engineering Trivandrum*
Subscribe to:
Post Comments (Atom)

very nice work have been done by you thanks to provide so exact answer with explaination..keep it up

ReplyDeletethank you for grouping the questions topic wise and yes good explanation.

ReplyDeleteGreat work with good explanation .

ReplyDeletereally its very helpful... Keep it up the good work.. Thanks

ReplyDeletegreat work

ReplyDeletegreat

ReplyDeletenice work dear

ReplyDeleteThanks

ReplyDeleteInformative, thanks

ReplyDeletetoo gud man!!! thanks 4 da help....god bless...

ReplyDeleteThis is wat i searching for....Thanks a lot......This will be helpful to many...

ReplyDeletetoooooooooooooooooo gud man u deserve a treat!!

ReplyDeleteThanks .....very good work...

ReplyDeleteA prime attribute can br transitively dependeny on a key in a BCNF relation.

ReplyDeleteReference Q10.

Shouldn't it be true because as long as determinant is a key who bothers about determiner side in BCNF?

THANKS

ReplyDeleteThis is nice stuff!

ReplyDeleteGood compilation

ReplyDeletethank u for publishing these kind of questions with explanation.very helpful to understand topics. thanks a lot. . .

ReplyDeleteVery Good Explanation.......................Thanks...

ReplyDeleteThank u so much for the solutions .

ReplyDeleteThanks u very much

ReplyDeleteGreat Work :)

ReplyDeletequestion 11- relation book is not in 2NF because, 3rd FD is violating the fully functional dependency rule.

ReplyDeleteprice (non prime attribute) is partially dependent on subset of primary key

If there was any FD like:

DeleteTitle->Price or

Author ->Price,

then we could say that price is partially dependent on subset of primary key. Neither Title nor Author alone, can determine Price. Hence, no partial functional dependency and 2NF condition satisfied.

gud job bro..keep it up.

ReplyDeleteGood Explanation!!

ReplyDeleteThanks a lot.

ReplyDeleteReally precise explanation. Really helpful

ReplyDeleteThanks for posting this qstns. Where can I find recent year qstns on DBM, FLAT and CN. Please help out.

ReplyDeleteThanks.

....good work

ReplyDeleteThanks

ReplyDeleteThanks

ReplyDeletenice collection of questions it will provide the great help to understand the concept of normalization

ReplyDeleteThanks, wonderful job ,

ReplyDeletety

ReplyDeleteThank you very much.

ReplyDelete