




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!





CS345 Midterm Examination Wednesday, May 14, 2003, 9:30 { 11:30AM
Directions
The exam is open book; any written materials may b e used.
Answer all 9 questions on the exam pap er itself.
The total numb er of p oints is 120 (i.e., 1 p oint p er minute).
Do not forget to sign the pledge b elow.
I acknowledge and accept the honor co de.
Print your name here:
Problem 1: (12 p oints) Let C 1 and C 2 denote two columns (items) of a matrix that represents market-basket data. Let C 1 _ C 2 denote a column that is the row-wise logical OR of the two columns; i.e., C 1 _ C 2 has a 1 when either C 1 or C 2 or b oth has a 1, and has 0 otherwise. Similarly, C 1 ^ C 2 denotes the row-wise logical AND of the two columns; i.e., C 1 ^ C 2 has a 1 if and only if b oth columns have 1. Let h(C ) denote the minhash value for column C. That is, h(C ) is the smallest i such that the ith row in the chosen (p ermuted) order of rows has a 1 in column C. For each of the following statements, indicate whether it is always true or sometimes false, by circling T or F, resp ectively.
a) h(C 1 _ C 2 ) = min
h(C 1 ); h(C 2 )
b) h(C 1 ^ C 2 ) = max
h(C 1 ); h(C 2 )
c) If h(C 1 ) = h(C 2 ), then h(C 1 _ C 2 ) = h(C 1 ) T F
d) If h(C 1 ) = h(C 2 ), then h(C 1 ^ C 2 ) = h(C 1 ) T F
Problem 2: (12 p oints) Let I n(x) denote the set of pages with link to page x, and let O ut(x) denote the set of pages to which page x links. Let h(x), a(x), and p(x) denote the \hubbiness," authority, and PageRank of page x, resp ectively. Indicate whether each of the following statements is always true (T) or sometimes false (F).
a) If O ut(i) O ut(j ), then h(i) h(j ). T F
b) If O ut(i) O ut(j ), then p(i) p(j ). T F
c) If I n(i) I n(j ), then p(i) p(j ). T F
d) If I n(j ) I n(i), then a(i) a(j ). T F
Problem 3: (15 p oints) What are all the stable mo dels for the following prop ositional- logic program?
p1 :- NOT q q1 :- NOT p p2 :- p p2 :- NOT q q2 :- NOT p
sure you have reached convergence.
Round 0 1 2 3 4 Truth Value p(1) p(2) p(3) p(4) c(1) c(2) c(3) c(4)
b) In the space b elow, draw the dep endency graph for the instantiated atoms p(i) and c(i) for 1 i 4.
c) Are the rules with the given EDB lo cally strati ed? If so, tell what the strata are; if not, describ e an in nite negative path.
d) Supp ose int contains the integers from 1 to n, and div ides contains all those pairs (i; j ) such that j divides i and i and j are integers b etween 1 and n. For what values of n will the rules and EDB b e lo cally strati ed? Explain brie y.
Problem 6: (16 p oints) A view-centric information system has a single view:
v(X,Y,Z) :- e(X,Y) & e(Y,Z) & e(X,Z)
We wish to answer the following query:
q(A,B,C,D) :- e(A,B) & e(B,C) & e(C,D) & e(A,C) & e(B,D) & e(A,D)
Notice that in this unusual case, neither the view de nition nor the query have any variables that do not app ear in the head. That fact may simplify reasoning ab out the problem. Also observe that the view describ es a triangle in a graph, but the edges are directed, and go in the direction from one argument of the head (representing a no de) to another that app ears to the right, among the arguments of the head. Likewise, the query asks for a complete graph of 4 no des, again with direction determined by \to the right, among the arguments of the head." A conjunctive query Q, all of whose subgoals have predicate v , is a solution if, after expansion, it is contained in the query. For Q to b e a minimal solution, any conjunctive query P formed by deleting one or more subgoals from the b o dy of Q must not b e a solution; i.e., the expansion of P is not contained in the query. For each of the prop osed solutions b elow, tell whether it is: (i) not a solution, (ii) a solution but not minimal, or (iii) a minimal solution. In each case, explain your reasoning brie y. Suggestions: describ e the expansions of the prop osed solutions and indicate containment mappings when needed.
a) q(A,B,C,D) :- v(A,B,C) & v(B,C,D)
b) q(A,B,C,D) :- v(A,B,C) & v(B,C,D) & v(A,C,D)
Problem 8: (16 p oints) Consider the following conjunctive queries with arithmetic:
Q 2 : panic :- a(X,Y) & a(Y,X) & X<Y Q 1 : panic :- a(A,B) & a(B,A) & A 6 =B
We wish to check whether or not Q 1 Q2.
a) Rewrite Q 1 and Q 2 as recti ed rules.
b) What are all the containment mappings from the uninterpreted subgoals of Q 2 to those of Q 1?
c) Write the statement ab out arithmetic that must b e checked to verify that Q 1 Q 2.
d) Is the condition of (c) true? Explain brie y.
Problem 9: (10 p oints) Supp ose a Web graph is undirected, i.e. page i p oints to page j if and only page j p oints to page i. Are the following statements true or false? Justify your answers brie y.
a) The hubbiness and authority vectors are identical, i.e for each page, its hubbiness is equal to its authority.
b) The matrix M that we use to compute PageRank is symmetric; i.e. M [i; j ] = M [j; i] for all i and j.