Vous êtes sur la page 1sur 4

CSL 332/632: Final Exam

May 4, 2012
1 Part A (Maximum: 10 points)
Instructions
1. Each question is worth 2 points.
2. Each question has one or more correct answers.
3. Points will be awarded if all and only the correct answers are marked.
1. Why is bulk loading a set of tuples into a table faster than inserting each tuple with an insert
statement?
(a) Because each insert statement has to be logged, while for a bulk load, there is only a single log
record, resulting in reduced overhead.
(b) Because the DBMS uses specialized data structures for bulk loading.
(c) Because bulk loading is ordered on the set of tuples, while inserts are not.
(d) Because bulk loading merely copies the le containing the tuples into another location, while insert
statements have to write each tuple separately.
2. Which of the following statements is false?
(a) R (S T) = (R S) (R T), holds for both sets and bags.
(b) R (R S) = R S, holds for both sets and bags.
(c) R (S T) = (R S) (R T), holds for both sets and bags.
(d) (R S) T = R (S T), holds for both sets and bags.
3. Assuming that R and S are sets and |R| = r and |S| = s, which of the following statements is true?
(a)
C
(R S) has a minimum of r tuples if condition C applies only to R.
(b) R
R.A=S.A
S has exactly r tuples if every value of R.A contains r unique values.
(c) R S has a maximum of rs tuples.
(d)
R.A
(R
R.A=S.A
S) and
S.A
(R
R.A=S.A
S) have exactly the same number of tuples.
4. Assuming set semantics, which of the following statements is true?
(a) The grouping operator can be used to do duplicate elimination.
(b) The operator can be expressed as a combination of {, , }.
(c) The full outer-join operator can be expressed as a combination of { , , }.
(d) The grouping operator , can be expressed as a combination of {, , }.
5. Given that A, B, C, D are attributes in some relational table, which of the following is true about
functional dependencies?
(a) If AB C holds, then either A B or A C holds.
(b) If AB C holds, then ABD C holds.
(c) If AB C holds, then ABD CD holds.
(d) If AB CD holds, then A C holds.
1
2 Part B (Maximum: 30 points)
Instructions
1. Each question below has exactly one answer.
2. You will receive 5 points for the right answer.
3. You will lose 2.5 points for the wrong answer.
1. Suppose we have the following schema: Person (id, name), CarType (carTypeId, type), Car (carId,
ownerId, carTypeId, carName) describing, respectively, people, types of cars, and cars and their
owners. The data corresponding to these tables is as follows:
Person CarType Car
id name carTypeid type carId ownerId carTypeId carName
1 Maya 1 Small 1 1 1 Nano
2 Amitabha 2 Medium 2 2 2 Santro
3 Naveen 3 Large
Suppose we were to issue the following queries:
Q1: select distinct Q.name from
(select P.name, C.carName
from Person P
left outer join Car C on (C.ownerId = P.id)) as Q
Q2: select distinct Q.name from
(select P.name, C.carName, CT.carTypeId
from Person P
left outer join Car C on (C.ownerId = P.id)
inner join CarType CT on (C.carTypeId = CT.carTypeId)) as Q
Q3: select distinct Q.name from
(select P.name, C.carName, CT.carTypeId
from Person P
left outer join Car C on (C.ownerId = P.id)
left outer join CarType CT on (C.carTypeId = CT.carTypeId)) as Q
What are the results returned by each query?
(a) Q1: {Amitabha,Naveen,Maya}, Q2: {Amitabha,Naveen,Maya}, Q3: {Amitabha,Naveen,Maya}
(b) Q1: {Amitabha,Naveen,Maya}, Q2: {Amitabha,Maya}, Q3: {Amitabha,Naveen,Maya}
(c) Q1: {Amitabha,Naveen,Maya}, Q2: {Amitabha,Naveen,Maya}, Q3: {Amitabha,Maya}
(d) Q1: {Amitabha,Naveen,Maya}, Q2: {Amitabha,Maya}, Q3: {Amitabha,Maya}
2
2. Suppose we are given the following transactions: T
1
: w
1
(X)w
1
(Y )w
1
(Z), T
2
: w
2
(X)w
2
(Y )w
2
(Z),
T
3
: w
3
(X)w
3
(Y )w
3
(Z). Consider the following 3 schedules:
S
1
: w
1
(X)w
2
(X)w
1
(Y )w
2
(Y )w
1
(Z)w
2
(Z)w
3
(X)w
3
(Y )w
3
(Z)
S
2
: w
1
(X)w
2
(X)w
3
(X)w
2
(Y )w
1
(Y )w
1
(Z)w
2
(Z)w
3
(Y )w
3
(Z)
S
3
: w
3
(X)w
1
(X)w
1
(Y )w
3
(Y )w
2
(X)w
3
(Z)w
2
(Y )w
1
(Z)w
2
(Z)
Which of the following statement is true?
(a) S
1
, S
2
, S
3
are all serializable schedules and this can be veried by the precedence graphs of each
schedule.
(b) S
1
, S
2
, S
3
are all serializable schedules, but only S
1
can be veried as such by its precedence graph.
(c) S
1
is serializable while S
2
, S
3
are not serializable, and this can be veried by their precedence
graphs.
(d) S
1
is serializable while S
2
, S
3
are not serializable, but no automated verication method exists.
3. Suppose we are given the relation Parent(X, Y ) which denotes that Y is the parent of X. Consider
the following datalog query:
A(X, Y ) Parent(X, W) AND Parent(Y, W) AND X! = Y
B(X, Y ) Parent(X, X1) AND Parent(Y, Y 1) AND B(X1, Y 1) AND X! = Y
B(X, Y ) A(X, Y )
What does B(X, Y ) return?
(a) All pairs of family members in the same level in their family tree and having a common ancestor.
(b) All pairs of family members in the same level in their family tree and having a common grand-
parent.
(c) All pairs of family members in the same level in their family tree and who have children.
(d) All pairs of family members in the same level in their family tree and who have children and a
common ancestor.
4. Consider a B-tree (named B5) of order 5 (max. 4 entries, 5 children per node) and a B-tree (named B3)
of order 3 (max. 2 entries, 3 children per node). Suppose we insert a sequence of numbers as follows:
19, 23, 20, 5, 78, 16, 25, 2, 93, 6. Which of the following is correct?
(a) B5 and B3 have the same entry (or entries) in the root. The total number of nodes in B5 is 3 and
B3 is 6.
(b) B5 has 6 and 20 at the root, and a total of 4 nodes. B3 has 20 at the root, and a total of 8 nodes.
(c) B5 has 20 at the root, and a total of 4 nodes. B3 has 20 at the root, and a total of 7 nodes.
(d) B5 has 6 and 20 at the root, and a total of 3 nodes. B3 has 6 at the root, and a total of 8 nodes.
3
5. Consider the following sequence of operations occurring during undo logging and redo logging. Note
that old and new refer to the old and new values of the variable involved.
Step Action UNDO log REDO log
1 start T start T
2 read (A,t)
3 (process t)
4 write (A,t) T,A,old T,A,new
5 read(B,t)
6 (process t)
7 write (B,t) T,B,old T,B,new
8 commit T
9 output (A)
10 output (B) commit T
Where should the FLUSH LOG be inserted?
(a) After step 8 for UNDO log and after step 10 for REDO log
(b) After steps 7 and 10 for UNDO log and after step 10 for REDO log
(c) After steps 7 and 10 for UNDO log and after step 8 for REDO log
(d) After step 10 for UNDO log and after steps 8 and 10 for REDO log
6. Suppose we have the following XML snippet:
<bookstore>
<book> <title lang="eng">Harry Potter</title> <price>29.99</price> </book>
<book> <title lang="eng">Learning XML</title> <price>39.95</price> </book>
</bookstore>
Consider the following XPath queries:
Q1: /bookstore/descendant::book[price > 30]
Q2: /bookstore/child::book[title = Learning XML]/child::price
Q3: /bookstore/descendant::*/parent::price
Q4: /bookstore/descendant::book/following-sibling::*/price
Which of them return the bold-ed node as the only result?
(a) All 4 return the specied result.
(b) Only Q1, Q2 and Q3.
(c) Only Q1 and Q3.
(d) Only Q2 and Q4.
3 Part C (Maximum: 5 points)
Instructions
Each question carries 1 mark. Keep your answers precise and brief (not more than 2 sentences).
1. Expand the terms ROLAP, MOLAP and HOLAP.
2. In the context of probabilistic databases, if a database has 250,000 tuples, what is the number of
possible worlds?
3. When publishing sensitive data, what is the most important tradeo?
4. Briey describe continuous queries in the context of data stream processing.
5. Name the 3 main network overlay architectures in P2P systems.
4

Vous aimerez peut-être aussi