CS 202 Midterm 1 Exam 24 Feb 2005 PDF

Summary

This is a midterm exam for CS 202, taken on 24 Feb 2005 at the University of Virginia. The exam covers logic, sets, functions, and proofs. It includes 12 short answer questions, each for 4 points, and 3 longer, more in-depth questions.

Full Transcript

CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 1/8 Name: ______________________________________ E-mail ID: [email protected] Pledge: _______________________________________________________________________ ______________________________...

CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 1/8 Name: ______________________________________ E-mail ID: [email protected] Pledge: _______________________________________________________________________ _____________________________________________________________________________ _____________________________________________________________________________ Signature: _____________________________________________________________________ There are 75 minutes for this exam and 100 points on the test; don’t spend too long on any one question! The 12 short answer questions require only a sentence or two for full credit; the three long answer questions have their own page, and obviously require more. The questions are organized by topic, so the long answer questions are scattered throughout the exam (questions 5, 14, and 15). The long answer questions are worth about half of the test score; the short answer questions are all worth 4 points each, and constitute the other half. The reference sheet is on page 2. All work must be on these exam pages. Good luck! Part I: Logic _____ / 33 Part II: Structures _____ / 16 Part III: Proofs _____ / 51 Total _____ / 100 CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 2/8 CS 202 Rules of inference (Rosen, p. 58) Rule of Tautology Name Exam 1 Reference Sheet Inference p p → ( p ∨ q) Addition ∴p∨q Set and logical identities p∧q ( p ∧ q) → p Simplifi- cation Sets (Rosen, p. 89) Name Boolean logic (Rosen, p. 24) ∴p AU∅ = A Identity laws p∧T≡ p p (( p) ∧ (q) ) → ( p ∧ q) Conjunction A IU = A p∨F ≡ p q A UU = U Domination p∨T≡T ∴p∧q [ p ∧ ( p → q )] → q AI∅ = ∅ laws p∧F ≡F p Modus AU A = A Idempotent p∨ p ≡ p ponens p→q AI A = A laws p∧ p≡ p ∴q (A) = A Complemen- tation law ¬(¬p ) ≡ p ¬q [¬q ∧ ( p → q)] → ¬p Modus AU B = BU A Commutative p∨q ≡q∨ p p→q tollens AI B = BI A laws p∧q≡q∧ p ∴ ¬p A U ( B U C ) = ( A U B) U C Associative ( p ∨ q) ∨ r ≡ p ∨ ( q ∨ r ) p→q [( p → q) ∧ (q → r )] → ( p → r ) Hypothetical A I ( B I C ) = ( A I B) I C laws ( p ∧ q) ∧ r ≡ p ∧ ( q ∧ r ) syllogism q→r A I ( B U C ) = ( A I B) U ( A I C ) Distributive p ∨ (q ∧ r ) ≡ ( p ∨ q ) ∧ ( p ∨ r ) ∴p→r A U ( B I C ) = ( A U B) I ( A U C ) laws p ∧ (q ∨ r ) ≡ ( p ∧ q ) ∨ ( p ∧ r ) p∨q [( p ∨ q) ∧ ¬p ] → q Disjunctive AUB = AIB DeMorgan’s ¬( p ∧ q ) ≡ ¬p ∨ ¬q syllogism laws ¬p AIB = AUB ¬( p ∨ q ) ≡ ¬p ∧ ¬q ∴q A U ( A I B) = A Absorption p ∨ ( p ∧ q) ≡ p laws p∨q [( p ∨ q) ∧ (¬p ∨ r )] → (q ∨ r ) Resolution A I ( A U B) = A p ∧ ( p ∨ q) ≡ p ¬p ∨ r AU A =U Complement p ∨ ¬p = T laws p ∧ ¬p = F ∴q ∨ r AI A = ∅ CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 3/8 Part I: Logic Question 1 (4 points): What is the converse of p→q? Question 2 (4 points): Given the Boolean proposition p↔q, write an equivalent compound proposition using only the operators ¬, ∧, and ∨. Question 3 (4 points): State the negation of the following quantified statement: ∀x∃y ( P( x) ∧ ¬Q( y ) ) Question 4 (4 points): What are the two ways to convert a propositional function into a proposition? CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 4/8 Question 5 (17 points): Prove that ( p ∧ ( p ∧ q)) ∧ (¬p ∨ q) ≡ ( p ∧ q) using logical equivalences. You must clearly label each step of the logical equivalence. CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 5/8 Part II: Structures (sets and functions) Question 6 (4 points): What is the difference between a subset and a proper subset? Question 7 (4 points): Why must a function f be 1-to-1 and onto if the function f is invertible (i.e. you can find an inverse function of f)? Question 8 (4 points): What is the cardinality of a power set of a set of n elements? Question 9 (4 points): Let f ( x ) = 5 x + 2 and g ( x) = 2 x + 3. What is ( f o g )( x) ? CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 6/8 Part III: Proofs Question 10 (4 points): What two properties must be shown for a uniqueness proof? Question 11 (4 points): Write an existential generalization of the quantified statement ∃xP( x ). If you introduce new variables, etc., clearly describe what they represent. Question 12 (4 points): What is the difference between a vacuous proof and a trivial proof? Question 13 (4 points): What movie did Professor Bloomfield show a preview of during class? CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 7/8 Question 14 (15 points): For this question, you will have to prove that if m is an even integer, then m+7 is an odd integer. You need to prove it two different ways: by direct proof, indirect proof, or proof by contradiction. Each proof method is worth the same amount. Proof method 1 (circle one): Direct proof Indirect proof Proof by contradiction Proof method 2 (circle one): Direct proof Indirect proof Proof by contradiction CS 202, Spring 2005 Midterm 1: 24 Feb 2005 Page 8/8 Question 15 (20 points): Consider the following statements. 1. If Dominic goes to the racetrack, then Helen will be mad. 2. If Ralph plays cards all night, then Carmela will be mad. 3. If either Helen or Carmela gets mad, then Veronica (their attorney) will be notified. 4. Veronica has not heard from either of these two clients. From these, can we conclude the following? Dominic didn’t make it to the racetrack and Ralph didn’t play cards all night. Write each of these statements in symbolic form. Clearly label what your Boolean variables represent! Then establish the validity of the conclusion. You must clearly label which rule of inference is used for each step.

Use Quizgecko on...
Browser
Browser