exam1v1 - MSU CSE 260 Exam 1 Sample Exam ANSWER Name This...

This preview shows pages 1–6. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MSU CSE 260 Exam 1 Sample Exam ANSWER Name: This sample exam does not include all types of questions that may be asked in this Friday’s EXAM. All the materials covered in the lectures are included in the exam. Topics included in the exam are Logic, Propositional Logic, Predicate Logic, Applications of Predicate Logic, Sets and Set Operations. Last page gives all the logical equivalences. Time: 50 minutes Logic 1. (5 pts) Determine the truth value of the following statements. Circle either True, False, or Undetermined. *T F U ” John is a student in CSE 260” is a proposition. *T F U ” (x+2)>(x+1) and x is a real” is a proposition. Though x appears to be a variable, the statement uses the concept to include all reals. *T F U If you get an A on the ﬁnal exam, then 2 + 3 : 5. *T F U s and /\ form a functionally complete collection of logical op— erators in propositional logic. T *F U Distributive law for multiplication over subtraction for all inte— gers is vayﬂz(x.(y * z) : my 7 56.2) 2. Consider the following compound proposition: “You will get an A in this class if you do every recommended homework or you do not get less than A on the ﬁnal exam.” Basic propositions p, q, 7" making up the above compound proposition are as follows: a p: you will get an A in this class a {1: you do every recommended homework o 7": you do get less than A on the final exam (a) (b) (6 pts) Express the initial compound proposition using p, q, 7", and logical con— nectives. (qulep (4 pts) Give the following if it can be determined based on the above ONLY. If it can’t be determined? write “Undetermined.” i. a sufﬁcient condition to get an A in this class. M V i") ii. a necessary condition to get an A in this class. Undetermined. (note p is the necessary condition for (q V N) (5 pts) Express the contrapositive of the initial compound proposition in part (a) and then express it as an English sentence starting with “If you . . .”. —up a —:(q V 7") If you do not get an A in this class then you did not do every recommended homework problem and you did not get less than A in the ﬁnal. Logical Equivalences . (5 pts) Using a truth table, determine whether the following implication is a tautology, contradiction or a contingency. (p 4} q) <—> (—q a» —:p) After giving the truth table, do NOT forget to state and justify your answer! 10 'TJ'TJI—JI—l q (p —> g) ﬁp ﬁg ﬁq —> ﬁp (p —> q) <—> (ﬁg —> ﬁp) '11-—1'T1-—1 -—1-—1-T1-—1 -—1-—1'T1'T1 -—1-T1-—1-T1 -—1-—1'T1-—1 -—1-—1-—1-—1 The implication is a tautology because it is always True. . (10 pts) Using substitution of logical equivalences ONLY (given in the table on the last page of this exam), show the following logical equivalence. Do NOT forget to justify each step with a rule! [(perlquerﬂ <=> [mam —Ip V ﬁg) V (r V r) 4:) Associative law —Ip V ﬁg) V r 4:) fdempotent law —I(p /\ g) V 7" 4:) DeMorgan’s law (p /\ q) a r Implication law . Give the truth values of S in the following table and then write in plain English the meaning of the statement S. Assume the universe of discourse is {1, 2? 3} s: 35(P(\$) Wm % y) e» spun) 13(1) 13(2) P(3) s T F F 1? F T T ? Predicates and Quantiﬁers . (8 pts) 8(X): X is a student C(X): X has to take CSE 101 Universe of discourse for the variable x above is all persons. Write logical expressions using predicates? quantiﬁers, and logical connectives for the following. (a) Everybody is a student Vm3(\$) (b) No one is a student Vw—IS(\$) (c) All students have to take CSE 101 WSW —> 01%)) (d) There is a student who do not have to take CSE 101 35513013) /\ not???» . Consider universe of discourse for all variables below is integers Z 0) Let us deﬁne four predicates Pf”): DUE, m)? Difﬂn, m, g) and sum(n, m, g) as follows: Mn): ”n is prime” Dmym): n is divisible by m Diff(n,m?q) : q 2| n i m | i.e., q is the difference of n and m. sum(n,m?q) : q = 70. +711 (a) (6 points) Write the following in ordinary English: 1- Vanfpfn) a (T901; m) /\ 71 7E ml) Any prime is not divisible by an integer other than itself. 11- Vn3m3q((p(n) —> 1001)) /\ 8113mm m, (1)) For any prime integer there exists an integer such that their sum is a prime. (b) (6 points) Translate the following into logical notation using p(n) and D(n,m). 10. 11. i. Any two prime integers do not divide each other. Vmanfpfm) /\ 1001)) e (anma 71) /\ nil—901m») ii. There are two prime integers difference of which is divisible by another prime integer. Hnﬂmﬂoﬂﬂﬂn) /\ Mm) /\ n 7E m /\ 10(0) /\ Difffnamﬁ) /\ DUI; 0)) Applications of Predicate Logic . (6 points) Relational Database Queries: Use predicate logic statement and set builder notation to represent the following queries. Student(x,y): Student x is taking course y lndicate which are free variables and which are bound variables in your answers. (a) Get those students who are taking all courses. {:13 | VyStudenﬂx, y)} Free: X, Bound: y (b) Get those students who are taking at least one course taken by John. {m | 39(Student(”John”,y) /\ Studenﬂmyyﬂ Free: X, Bound: y . (4 points) Prolog: Suppose that Prolog facts are used to deﬁne the predicates Mother(M, Y) and Father(F, X), which represent that M is the mother of Y and F is the father of X , respectively. Give a Prolog rule to deﬁne the following predicates: Sibling(X,Y), which represents that X and Y are siblings (that is, have the same mother and father). GrandFather(X,Y) which represents that X is the grand—father (paternal or mater— nal) of Y. Sets and Set Operations (3 points) Assume the universal set is the set of integers. List the elements in: {x l 3y(:c=2y+1)/\(y2 *1)/\(y :3)} Identify which are free variables and which are bound variables. {—171337537} Free: X, Bound: y (4 pts) In the Venn diagram below, shade the region that corresponds to the set (A 7 B) U (A 7 C) 12. (4 pts) Using a set membership table show for the two sets A and B that AUBzAﬂB A B A U B A U B A B A H B OOHH OHOH OI—LI—LI—L HOOD I—LI—LOO HOl—‘O HOOD Fourth and seventh columns are the same. 13. (14 points) Determine Whether each of the following statements is true or false. (a [B€{0} F {1,323} equal to {2,13} T Logical Equivalences. Equivalence Name p/\T<:)p pVF<E>p Identity laws pVT<E>T pAF<:)>F Domination laws prﬁp pApﬁp ldempotent laws o(op) <:>> p Double negation law p V q (E) g V p Commutative laws 10 A q <:> q A p (p V q) V T (E) p V (g V T) Associative laws (JD/WM?“ <:> qu/W) p V (q /\ 7") <:)> (p V q) /\ (p V i“) Distributive laws quVﬂ <=> (FACIDWPM) ﬁp /\ q) <:>> op V oq De Morgan’s laws up V 61) <=> op /\ oq p V op <:)> T Tautology p /\ op <:)> F Contradiction (p o q) (E) (op V q) Implication law ...
View Full Document

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern