Thursday, 3 March 2016

Normal forms and normalization MCQ

Multiple choice questions with answers explained on the concepts Normal forms and normalization, Normalization quiz with answers


1. Carefully observe the relational schema given below, and select one of the following that would violate the 2NF property?
Student (Register_No, Name, Phone, Branch, Course_No, Course_Name)
(a) Register_No, Name
(b) Course_No, Course_Name
(c) Register_No, Phone
(d) Phone, Branch
Why? – It is very evident that course_name is dependent on attribute course_no, and register_no, course_no would be the primary key for this relation. Hence, course_name shows partial dependency. But, no partial dependency is permitted for a relation to be in 2NF.

2. The rule that a value of a foreign key must appear as a value of some specific table is
called a ______
(a) Referential integrity
(b) Entity integrity
(c) Unique integrity
(d) Dependent integrity
Why? – For referential integrity to hold in a relational database, any field in a table that is declared a foreign key can contain either a null value, or only values from a parent table’s referenced columns (primary key or candidate keys). In other words, when a foreign key value is used it must reference a valid, existing primary key in the parent table.

3. For a relation R with schema R (A, B, C, D), let us assume that A is the primary key. And, R consists of the set of functional dependencies F = {A B, A → C, AB → C, C D}. Which of the following would violate the 3NF rule?
(a) AB → C
(b) C D
(c) A → BCD
(d) None of the above
Why? – 3NF – “no non-key attribute should depend on another non-key attribute” (i.e, no Transitive dependency). In this question, a non-key attribute D is fully functionally dependent on another non-key attribute C. Hence, it violates 3NF.

4. For a relation R (A, B, C, D), we assume that the key is (A, B), a composite key. With this information, we would say which of the following is TRUE for R.
(a) R may be in 2NF
(b) R may be in 3NF
(c) R may be in BCNF
(d) Not enough information
Why? – The only information given is the primary key of the table. And the primary is a composite key. Hence, we would say that the table can be in 2NF. We need the set of functional dependencies for deciding further.

5. Consider a relation R (A, B, C) with F = {A B, C B}. Assume that we decompose R into R1 (A, B) and R2 (A, C). Which of the following is TRUE for this case?
(a) R1 and R2 are in BCNF
(b) Dependency preserving decomposition
(c) R1 and R2 are in 3NF
(d) All of the above
Why? – If we have a relation with just two attributes we cannot look for partial key dependency, non-key dependency, or multiple candidate keys. Hence, the relation is in 3NF and BCNF.
The decomposition given above is not dependency preserving decomposition. Because, the decomposition results in elimination of C B.

No comments:

Post a Comment

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...