


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



This exam has 3 pages and 7 problems totaling 90 points. This is closed book and closed notes. No calculator is allowed in this exam.
n1 t n2 t n2 t n3 t
(a) (5 points) Write the above relational table in set notation. {(n 1 , t1), (n 2 , t1), (n 2 , t2), (n 3 , t3)} (b) Provide a meaning of each of the following queries in simple English. Give the results of the queries in set notation. i. (5 point) {y | ∃xP T (x, y) ∧ x = n 2 } Tel numbers of n2. {t 1 , t 2 } ii. (5 points) {x | ∃yP T (x, y) ∧ ∀z (x 6 = z → ¬P T (z, y)} Names of those with tel not shared by anyone else. {n 2 , n 3 } iii. (5 points) {z | ∃x∃y P T (x, z) ∧ P T (y, z) ∧ x 6 = y} tel shared by more than one person. {t 1 } iv. (5 points) Give an SQL statement for the query of (b)i.
select x.tel from PT x where x.name=n
(a) (5 points) 001010 0 ∗ 1 ∗ 0 ∗^ false (b) (5 points) Following is a set of valid production rules for a regular grammar: True S → aS S → bS | c
(a) (5 points) G :< V, T, S, P > V = {S, A, B, a, b, c} T = {a, b, c} P={S → AB, A → aA | c, B → bB | c}
{aicbj^ c | i ≥ 0 ∧ j ≥ 0 } (b) (5 points) G :< V, T, S, P > V = {S, a, b, c} T = {a, b, c} P={S → aSb, S → cS | λ}
{x | x is any combination of a’s and c’s followed by b’s and the number of a’s is equal to number of b’s}
Grammar: (V, T, S, P ) V = {S, A, D, D′, 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } T = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } P = { S → AD A → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 D → D′D | λ D′^ → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 }
{s0} (^) {s0,s1} 1
0 0,
Steps described in class.