CSE-3421 Test #1: "Design"
CSE-3421 Test #1: "Design"
1 of 10
CSE-3421 Test #1
“Design”
Family Name:
Given Name:
Student#:
CS Account:
Answer the following questions to the best of your knowledge. The exam is closed-book and
closed-notes. Questions will not be answered during the test. Should you feel a question needs an
assumption to be able to answer it, write the assumptions you need along with your answer. If you
need more room to write an answer, clearly indicate where you are continuing the answer.
There are four major questions worth 10 points each for 40 points in total.
Regrade Policy
• Regrading should only be requested in writing. Write what you would like to be reconsidered.
Note, however, that an exam accepted for regrading will be reviewed and regraded in entirety
(all questions).
Grading Box
1. /10
2. /10
3. /10
4. /10
Total /40
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 2 of 10
Physician phy#
trauma# severity
tname
success treated with when
pname Procedure
a. (4 points) Figure 1 represents Dr. Bas’s first attempt. Identify clearly at least two
distinct major problems with the E-R diagram with respect to the specifications.
• The relationship treated with does not accommodate that the same procedure may
be applied a second time to a given patient’s trauma.
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 3 of 10
b. (6 points) Present your own E-R design for the E/R specifications.
pname Procedure
pat# InPatient
type of
severity has
b. F Anything that can be expressed in an E-R diagram via a ternary relationship can be
expressed in some other logically equivalent way without the use of ternary relationships.
c. F Under a relational database system, if table R has a foreign key constraint referencing
table S, then each tuple in R is necessarily related to some tuple in S via the foreign key.
d. T The SQL statement “DELETE FROM R” might cause tuples in tables other than just R
to be deleted.
e. F NULL values can be used to opt a tuple out of enforcement of the primary key.
f. T NULL values can be used to opt a tuple out of enforcement of a foreign key.
h. T Consider a relation with four attributes (say, A, B, C, and D). There are 15 possibilites
for what its primary key could be set to (e.g., ACE).
i. T We know that table Q has only one candidate key. If Q is in 3NF, it is also in BCNF.
3. Reverse Engineering. I’ve always wanted to direct. (10 points) [Short Answer]
A relational schema for movies and casts is given in Figure 2. The primary key for each
relation is indicated by the underlined attributes, as sin in Person (and are, hence, not
nullable). Attributes in italics are not nullable, as director in Movie. The foreign keys with
each are written as FK . . .
The attributes title and year in table Person indicate that person’s favorite movie. The
attribute job of Person is allowed two values: ’actor’ or ’director’. Only actors are allowed
to act in (Cast) movies. Only directors are allowed to direct (director). A movie is produced
by a studio. A person (actor or director) can be contracted by a studio (but by at most one
studio), as indicated by studio in Person.
Imagine an E-R diagram for which the relational schema in Figure 2 is a correct translation.
b. (2 points) Is Cast likely a relationship or an entity in the E-R diagram? Briefly support
your answer.
It is likely a relationship because its key is the union of its foreign keys.
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 6 of 10
c. (2 points) How many relationships does the entity Person participate in?
Four.
d. (2 points) Is it possible that the table Movie contain the rows as above?
Yes. The key for Movie is {title, year}. The title value is the same for these two rows, but
their year values are different.
e. (2 points) Can we represent that the same actor (person) has several roles in a movie?
Why or why not?
No. Cast can associate a given movie and person once, given the key of the table. That one
row has a role value. There is no way to associate more than one role value.
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 7 of 10
4. Normalization. Who’s to say what’s normal? (10 pts) [Short Answer / Exercise]
c. (2 points) Devise a simple example of a relation and functional dependencies such that
it is in 2NF but not in 3NF.
A 7→ B
B 7→ C
So {A} is the only candidate key for ABC. The second functional dependency (FD) breaks
3NF since B is not a key or super-key and C is not prime.
This is in 2NF, though. The first FD is fine: {A} is key. The second FD is fine: {B} is
not a sub-key.
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 9 of 10
Extra space.
2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 10 of 10
Extra space.