2006-fall-cs4604-final-solutions

2006-fall-cs4604-final-solutions - CS4604 Final Examination...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS4604 Final Examination December 11, 2006 Please enter the following information: Name: ID: GOOD LUCK! Please do not write below this line. Question Maximum Score Score 1 30 2 7 3 11 4 12 5 20 6 20 7 * 20 Total 100 * Extra credit 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. (3 × 10 = 30 points) (a) If relation R has n tuples and relation S has m tuples, what is the maximum number of tuples that R S can contain? Assume set-theoretic semantics. Solution: The answer is min( m,n ). A number of students answered “ n , when S contains no tuples in R ”. I deducted two points for that answer. (b) An E/R diagram has three entity sets A , B , and C . It also contains three relationships: R between A and B ; S between B and C ; and T between C and A . The relationships do not contain any attributes. Which of the relationships is redundant, i.e., the tuples contained in it can be inferred from the tuples in the other two relationships? Solution: All may be needed, since different entities may participate in each relationship. Some students said T is redundant. How can that be? The situation is completely symmetric? If T is redundant, then why are R and S not redundant? (c) The scenario is the same as in the previous question. In addition, you know that each relationship is one-one. Which relationships are redundant? Solution: The one-one constraints do not make any relationship redundant. Once again, different tuples may belong to each relationship. (d) How many non-trivial multi-valued dependencies are possible in a two attribute relation? Solution: Zero. Any multi-valued dependency in this relation must involve both two attributes. Hence, it is trivial. (e) What is the difference between “ DROP R; ” and “ DELETE FROM R; ”? Solution: DROP R; deletes the entire table from the database, whereas DELETE FROM R; deletes all the tuples in the table but retains the table definition in the database. A number of students said that the second query deletes one or some tuple from R , which is incorrect. I deducted one point for that error. Note that DELETE FROM R; is a valid SQL query. (f) When is an attribute-based CHECK constraint checked by an RDBMS? Solution: I was looking for a specific answer: whenever an update to the table containing that attribute changes the value of the attribute. I deducted two points for generic answers such as “when a change is made to the database” or “inserts and updates”. (g) Rewrite σ C ( R × S ) as another expression in relational algebra. Solution: R ./ C S (h) A relation R has attributes A , B , and C . Fill in the blank so that the query returns each tuple in R exactly once. SELECT * FROM R ; Solution: I goofed on this question. I meant to ask for a query that returns each distinct tuple in R exactly once. In that case, the answer is GROUP BY A, B, C . For the question I actually asked, you can leave the blank empty. I did deduct two points when students completed the query using illegal SQL. (i) Circle
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/24/2011 for the course CS 4604 taught by Professor Cmmalik during the Fall '08 term at Virginia Tech.

Page1 / 12

2006-fall-cs4604-final-solutions - CS4604 Final Examination...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online