GATE 2004
199 questions
MCQ 1991-mark 199
Questions 156–160 of 199
Consider the following entity relationship diagram (ERD), where two entities E1 and E2 have a relation R of cardinality 1:m.
The attributes of E1 are A11, A12 and A13 where A11 is the key attribute. The attributes of E2 are A21, A22 and A23 where A21 is the key attribute and A23 is a multi-valued attribute. Relation R does not have any attribute. A relational database containing minimum number of tables with each table satisfying the requirements of the third normal form (3NF) is designed from the above ERD. The number of tables in the database is
The attributes of E1 are A11, A12 and A13 where A11 is the key attribute. The attributes of E2 are A21, A22 and A23 where A21 is the key attribute and A23 is a multi-valued attribute. Relation R does not have any attribute. A relational database containing minimum number of tables with each table satisfying the requirements of the third normal form (3NF) is designed from the above ERD. The number of tables in the database is
Answer: (B)
Map the ER diagram to tables. E1 and E2 are in a 1:m relation, so the key of E1 goes into E2 as a foreign key, and R needs no table of its own. A multi-valued attribute cannot sit in a table with the key, since it would repeat rows.
One table per entity gives:
T1:
T2:
is multi-valued. If we keep it in T2, we must repeat rows for its many values, so the key of T2 becomes . This gives a partial FD , so T2 is not in . To fix this, we make a separate table for the multi-valued attribute. Then we get:
T1: , key
T2: , key ( is the foreign key)
T3: , key
Here the determinant of every FD is a key, so all the relations are in , and so in . We cannot use fewer tables without NULL entries or repeated data, so we need tables.
Answer: (B)
One table per entity gives:
T1:
T2:
is multi-valued. If we keep it in T2, we must repeat rows for its many values, so the key of T2 becomes . This gives a partial FD , so T2 is not in . To fix this, we make a separate table for the multi-valued attribute. Then we get:
T1: , key
T2: , key ( is the foreign key)
T3: , key
Here the determinant of every FD is a key, so all the relations are in , and so in . We cannot use fewer tables without NULL entries or repeated data, so we need tables.
Answer: (B)
The relation scheme Student Performance (name, courseNo, rollNo, grade) has the following functional dependencies:
name, courseNo, grade
rollNo, courseNo grade
name rollNo
rollNo name
The highest normal form of this relation scheme is
name, courseNo, grade
rollNo, courseNo grade
name rollNo
rollNo name
The highest normal form of this relation scheme is
Answer: (B)
Candidate keys. courseNo is never on the right side of an FD, so every key contains it. From and , name and rollNo determine each other. So (name, courseNo) gives rollNo and grade, and (rollNo, courseNo) gives name and grade. Both are keys. Neither can be shortened, since courseNo alone, name alone or rollNo alone does not determine every attribute. So name, rollNo and courseNo are prime, and grade is non-prime.
2NF. A violation needs a non-prime attribute that depends on part of a key. The FDs name rollNo and rollNo name have part of a key on the left, but their right side is prime. The FDs for grade have a whole key on the left. So the relation is in 2NF.
3NF. For every FD , either is a super key or is prime. FDs 1 and 2 have keys on the left. FDs 3 and 4 have prime attributes on the right. So the relation is in 3NF.
BCNF. Every FD must have a super key on the left. In name rollNo, name is not a super key, since it does not determine courseNo. So the relation is not in BCNF, and so not in 4NF either.
Answer: (B)
2NF. A violation needs a non-prime attribute that depends on part of a key. The FDs name rollNo and rollNo name have part of a key on the left, but their right side is prime. The FDs for grade have a whole key on the left. So the relation is in 2NF.
3NF. For every FD , either is a super key or is prime. FDs 1 and 2 have keys on the left. FDs 3 and 4 have prime attributes on the right. So the relation is in 3NF.
BCNF. Every FD must have a super key on the left. In name rollNo, name is not a super key, since it does not determine courseNo. So the relation is not in BCNF, and so not in 4NF either.
Answer: (B)
Consider a table T in a relational database with a key field K. A B-tree of order p is used as an access structure on K, where p denotes the maximum number of tree pointers in a B-tree index node. Assume that K is 10 bytes long; disk block size is 512 bytes; each data pointer is 8 bytes long and each block pointer is 5 bytes long. In order for each B-tree node to fit in a single disk block, the maximum value of p is
Answer: (C)
A B-tree node of order p has p block pointers (5 bytes each), and p-1 keys (10 bytes each) with p-1 data pointers (8 bytes each). It must fit in a 512-byte block:
The largest whole value is .
Answer: (C)
The largest whole value is .
Answer: (C)
The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes, and the block size is 512 bytes. What is the order of the internal node?
Answer: (C)
An internal node of order p has p child pointers (6 bytes each) and p-1 search values (14 bytes each). It must fit in a 512-byte block:
The largest whole value is .
Answer: (C)
The largest whole value is .
Answer: (C)
Consider the following schedule S of transactions T1 and T2:
Which of the following is TRUE about the schedule S ?
Which of the following is TRUE about the schedule S ?
Answer: (D)
A schedule is serializable if, for every initial database state, its effect is the same as that of some serial schedule. This is wider than conflict or view serializability.
A schedule can be neither conflict nor view serializable and still be serializable, because the actual computations decide the final values. For example, here each transaction only adds a constant, and the additions can be done in either order, so the schedule gives the same result as both and :
Since the computations are given in this question, compare the final values directly. Let and at the start. The given schedule ends with and :
Serial schedule ends with and :
Serial schedule ends with and :
The value of in the given schedule matches neither serial schedule. So the schedule is not serializable as and not as .
For contrast, change to . This schedule ends with and :
gives , the same result:
gives , which is different:
So is serializable only as , even though it is neither conflict nor view serializable. When the computations are given, check serializability from the final values like this; for the question as given, no serial order matches.
Answer: (D)
A schedule can be neither conflict nor view serializable and still be serializable, because the actual computations decide the final values. For example, here each transaction only adds a constant, and the additions can be done in either order, so the schedule gives the same result as both and :
Since the computations are given in this question, compare the final values directly. Let and at the start. The given schedule ends with and :
Serial schedule ends with and :
Serial schedule ends with and :
The value of in the given schedule matches neither serial schedule. So the schedule is not serializable as and not as .
For contrast, change to . This schedule ends with and :
gives , the same result:
gives , which is different:
So is serializable only as , even though it is neither conflict nor view serializable. When the computations are given, check serializability from the final values like this; for the question as given, no serial order matches.
Answer: (D)