Database test on “Tuple Relational Calculus and Domain Relational Calculus”.
1. Find the ID, name, dept name, salary for instructors whose salary is greater than $80,000 .
a) {t | t ε instructor ∧ t[salary] > 80000}
b) Э t ∈ r (Q(t))
c) {t | Э s ε instructor (t[ID] = s[ID]∧ s[salary] > 80000)}
d) None of the mentioned
Answer: a
Clarification: This expression is in tuple relational format.
2. A query in the tuple relational calculus is expressed as:
a) {t | P() | t}
b) {P(t) | t }
c) {t | P(t)}
d) All of the mentioned
Answer: c
Clarification: The tuple relational calculus, is a nonprocedural query language. It describes the desired information without giving a specific procedure for obtaining that information.
3.
{t | Э s ε instructor (t[name] = s[name] ∧ Э u ε department (u[dept name] = s[dept name] ∧ u[building] = “Watson”))}
Which of the following best describes the query?
a) Finds the names of all instructors whose department is in the Watson building
b) Finds the names of all department is in the Watson building
c) Finds the name of the dapartment whose instructor and building is Watson
d) Returns the building name of all the departments
Answer: a
Clarification: This query has two “there exists” clauses in our tuple-relational-calculus expression, connected by and (∧).
4. Which of the following symbol is used in the place of except?
a) ^
b) V
c) ¬
d) ~
Answer: c
Clarification: The query ¬P negates the value of P.
5. “Find all students who have taken all courses offered in the Biology department.” The expressions that matches this sentence is :
a) Э t ε r (Q(t))
b) ∀ t ε r (Q(t))
c) ¬ t ε r (Q(t))
d) ~ t ε r (Q(t))
Answer: b
Clarification: ∀ is used denote “for all” in SQL.
6. Which of the following is the comparison operator in tuple relational calculus
a) ⇒
b) =
c) ε
d) All of the mentioned
Answer: b
Clarification: The comparison operators are (<, ≤, =, =, >, ≥).
7. An expression in the domain relational calculus is of the form
a) {P(x1, x2, . . . , xn) | < x1, x2, . . . , xn > }
b) {x1, x2, . . . , xn | < x1, x2, . . . , xn > }
c) { x1, x2, . . . , xn | x1, x2, . . . , xn}
d) {< x1, x2, . . . , xn > | P(x1, x2, . . . , xn)}
Answer: d
Clarification: Here x1, x2, . . . , xn represent domain variables. P represents a formula composed of atoms, as was the case in the tuple relational calculus.
8. Find the names of all instructors in the Physics department together with the course id of all courses they teach:
a)
{< c > | Э s (< c, a, s, y, b, r, t >ε section ∧s = “Fall” ∧ y = “2009” ∨Эu (< c, a, s, y, b, r, t >ε section ∧s = “Spring” ∧ y = “2010”
b)
{< n, c > | Э i, a (< i, c, a, s, y > ε teaches ∧ Э d, s (< i, n, d, s > ε instructor ∧ d = “Physics”))}
c)
{< n > | Э i, d, s (< i, n, d, s > ε instructor ∧ s > 80000)}
d)
{< i, n, d, s > | < i, n, d, s > ε instructor ∧ s > 80000}
View Answer
Answer: b
Clarification: None.
9. In domain relaional calculus “there exist” can be expressed as
a) (P1(x))
b) (P1(x)) Э x
c) V x (P1(x))
d) Э x (P1(x))
Answer: d
Clarification:Э is used to denote “some” values in relational calculus.
10. A set of possible data values is called
a) Attribute
b) Degree
c) Tuple
d) Domain
Answer: d