Docsity

CS 173: Midterm Exam 1 - Spring 2007, Exams of Discrete Structures and Graph Theory

Partial preview of the text

Download CS 173: Midterm Exam 1 - Spring 2007 and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

CS 173: Midterm Exam 1

Spring 2007

Name:

NetID:

Section Leader:

General Directions

  1. Make sure your name is on every page.
  2. Remember to write clearly and legibly. Unreadable answers will receive no credit.
  3. This is a closed book exam. No notes of any kind are allowed. No calculators.
  4. Remember to time yourself.

Question Points Out of

Total 100

Multiple Choice

Problem 1 (5pts)

Which of these pairs of propositions is NOT equivalent?

a) (q ∨ r) → p and p ∨ (¬q ∧ ¬r)

b) ¬((p ∧ ¬q) ∧ ¬(¬p ∨ ¬q)) and q

c) p ∧ (q ∨ r) and (p ∧ q) ∨ (p ∧ r)

d) (p ∨ q) → (p ∨ q) and T rue

Answer: (b)

Problem 2 (5pts)

Disjunctive normal form is a disjunction of clauses, each of which is a conjunction. The negations are allowed, but only before the atomic symbols. For example (p∧q∧r)∨(p∧¬q) is in disjunctive normal form, while (p∧q∧r)∨¬(p∧¬q) and (p ∧ q ∧ r) ∨ (p ∨ ¬q) are not (because of the second clause).

In this question we give you an intuition why any boolean function can be expressed in disjunctive normal form, which means that any boolean function can be written only in terms of {∨, ∧, ¬}.

Which of the following is a disjunctive normal form equivalent to the proposition (p ↔ (q → p)) ∧ q? Hint: You can use the truth table to find the disjunctive normal form of this proposition.

a) (p ∧ q) ∨ (¬p ∧ q)

b) (p ∧ ¬q)

c) (p ∧ ¬q) ∨ (¬p ∧ q) ∨ (¬p ∧ ¬q)

d) (p ∧ q) ∨ (¬p ∧ q) ∨ (¬p ∧ ¬q)

Answer: (a)

Problem 5 (5pts)

Let P (m, n) be “m is greater than n” where the universe of the discourse is the set of nonnegative integers. Which of the following is true?

a) ∃m∀nP (m, n)

b) ∃n∀mP (m, n)

c) ∀m∀nP (m, n)

d) ∀n∃mP (m, n)

Answer: (d)

Problem 6 (5pts)

Which of the following is true?

a) { 2 } ⊆ { 1 , 2 } × { 2 , 3 }

b) { 2 , φ} ⊆ 2 A, where A = {φ, 2 , {φ}} and the symbol 2 A^ denotes the power set of A.

c) B ∈ 2 A^ → B ⊆ A, where A and B are two sets. The symbol 2 A^ denotes the power set of A.

d) S − (A

B) = (S − A)

(S − B), where A,B, and S are three sets.

Answer: (c)

Problem 7 (5pts)

Let S and T be two nonempty finite sets. Denote by F the set of functions defined on S and T : F = {f |f : S → T }. Which of the following is NOT true?

a) F is NOT an empty set.

b) if |S| < |T |, there are no onto functions in F.

c) if |S| = |T |, every function in F is either one-to-one, onto, or both.

d) if |S| > |T |, there are no bijections in F.

Answer: (c)

Problem 8 (5pts)

Which of the following functions is NOT one-to-one from R+^ to R+? Here R+^ denotes the set of all positive reals.

a) f (x) = (^) x+1^1

b) f (x) = ex^ − 1

c) f (x) = log 2 (x + 1)

d) f (x) = (x − 3)^2 + 1

Answer: (d)

Problem 10 (15pts)

a) Give a definition for the big-O notation. That is, define what it means to say that f (x) = O(g(x))? Solution: f (x) = O(g(x)) if there exist constants c,n, such that for all x > n: |f (x)| < c|g(x)|.

b) Use the definition to prove that log(x^2 + x + 10) = O(log(x)). Solution: Consider x > 10. x^2 + x + 10 < 3 x^2 < x^3 , and since log is monotonic, log(x^2 + x + 10) < log(x^3 ) = 3 log(x), which shows that the definition holds for n = 10 and c = 3.

c) Show that if f and g are real-valued functions so that f (x) = O(g(x)), then for any positive integer k, (f (x))k^ = O((g(x))k). Solution: Since f (x) = O(g(x)), there exist constants c,n, such that for all x > n we have |f (x)| < c|g(x)|. From this it follows that |f (x)|k^ < ck|g(x)|k. Therefore for c′^ = ck^ and n′^ = n, the definition of big-O hold for (f (x))k^ = O((g(x))k). Note that |f (x)|k^ < c|g(x)|k^ does not necessatly hold.

Problem 11 (15pts)

We know that

1 Rex is a rabbit.

2 Jack doesn’t like math.

3 Those who know calculus like math.

4 Rabbits never talk to those who don’t know calculus.

Suppose R(x) is “x is a rabbit”, M (x) is “x likes math”, C(x) is “x knows calculus”, and T (x, y) is “x talks to y”.

a) Express each of the four statements using quantifiers, logical connective, and R(x), M (x), C(x), and T (x, y). Solution: R(Rex) ¬M (Jack) ∀x, C(x) → M (x) ∀x, y, (R(x) ∧ (¬C(y))) → ¬T (x, y)

b) Prove that Rex doesn’t talk to Jack using rules of inferences. Solution:

1 ∀x(C(x) → M (x)) Premise 2 C(Jack) → M (Jack) Universal instantiation from [1] 3 ¬M (Jack) Premise 4 ¬C(Jack) Modus tollens from [2] and [3] 5 ∀x∀y((R(x) ∧ ¬C(y)) → ¬T (x, y)) Premise 6 (R(Rex) ∧ ¬C(Jack)) → ¬T (Rex, Jack) Universal instantiation from [5] 7 R(Rex) Premise 8 R(Rex) ∧ ¬C(Jack) Conjunction of [4] and [7] 9 ¬T (Rex, Jack) Modus ponens

SCRATCH PAPER