GATE 2000
54 questions
MCQ 541-mark 54
Questions 51–54 of 54
Given relations r(w, x) and s(y, z) the result of
select distinct w, x from r, s
is guaranteed to be same as r, provided.
Answer: (A)
The cross product repeats every tuple of once for each tuple of . If is empty, the product is empty. select distinct w, x keeps the columns of and removes duplicate rows.
So the result is the same as only when is non-empty (so no tuple of is lost) and has no duplicates (because distinct would remove them). In SQL a relation can hold duplicates, since it is a multiset.
(A) gives exactly these two conditions.
(B) is wrong: if is empty, the result is empty, and this can differ from .
(C) is wrong for the same reason, and also because may have duplicates, which distinct removes.
(D) is wrong: equal numbers of tuples do not stop from having duplicates, which distinct would remove.
Answer: (A)
So the result is the same as only when is non-empty (so no tuple of is lost) and has no duplicates (because distinct would remove them). In SQL a relation can hold duplicates, since it is a multiset.
(A) gives exactly these two conditions.
(B) is wrong: if is empty, the result is empty, and this can differ from .
(C) is wrong for the same reason, and also because may have duplicates, which distinct removes.
(D) is wrong: equal numbers of tuples do not stop from having duplicates, which distinct would remove.
Answer: (A)
Given the following relation instance.
Which of the following functional dependencies are satisfied by the instance?
Which of the following functional dependencies are satisfied by the instance?
Answer: (B)
An FD holds when rows with the same value always have the same value. If all values are different, it holds automatically.
All values (4, 5, 6, 2) are different, so any FD with or on the left holds. So and both hold, which is option (B).
The other options each have a violated FD:
(A) fails: appears with and .
(C) fails: appears with and .
(D) fails: appears with and .
Answer: (B)
All values (4, 5, 6, 2) are different, so any FD with or on the left holds. So and both hold, which is option (B).
The other options each have a violated FD:
(A) fails: appears with and .
(C) fails: appears with and .
(D) fails: appears with and .
Answer: (B)
-trees are preferred to binary trees in databases because
Answer: (B)
Reading from disk takes a seek and rotation, which is far slower than reading memory. So the cost of an index search is the number of disk accesses. A B+ tree node fills one disk block and has a high fanout, so the tree is very shallow and a search needs only a few disk accesses. A binary tree is much deeper and needs many more. This is useful because disk access is much slower than memory access, so (B) is the reason.
(A) Disk capacity does not change how a search is done. (C) The cost of one access is mostly seek and rotation delay, not the transfer rate, and the B+ tree helps by cutting the number of accesses. (D) Reliability has no bearing on the tree shape.
Answer: (B)
(A) Disk capacity does not change how a search is done. (C) The cost of one access is mostly seek and rotation delay, not the transfer rate, and the B+ tree helps by cutting the number of accesses. (D) Reliability has no bearing on the tree shape.
Answer: (B)
X, Y and Z are closed intervals of unit length on the real line. The overlap of X and Y is half a unit. The overlap of Y and Z is also half a unit. Let the overlap of X and Z be k units. Which of the following is true?
Answer: (D)
Place Y = [0, 1]. A unit interval [a, a + 1] overlaps Y by when . For overlap we need , so X and Z are each either or .
If X and Z are the same interval, k = 1.
If they are different, they meet only at the single point , so k = 0.
So k is either 0 or 1, never a value in between. (A), (B) and (C) are all false.
Answer: (D)
If X and Z are the same interval, k = 1.
If they are different, they meet only at the single point , so k = 0.
So k is either 0 or 1, never a value in between. (A), (B) and (C) are all false.
Answer: (D)