*exam 1 answer key* - home | eecs · this one was tricky because the answer depends on if the...

12
*EXAM 1 Answer key* EECS 203 Spring 2016 Name (Print): _______________Key_________________________________ uniqname (Print): ________________Key________________________________ Instructions. You have 110 minutes to complete this exam. You may have one page of notes (8.5x11.5 two-sided) but may not use any other sources of information, including electronic devices, textbooks, or notes. Leave at least one seat between yourself and other students. Please write clearly. If we cannot read your writing, it will not be graded. Honor Code. This course operates under the rules of the College of Engineering Honor Code. Your signature endorses the pledge below. After you finish your exam, please sign on the line below: I have neither given nor received aid on this examination, nor have I concealed any violations of the Honor Code. ________________________________________________________________

Upload: others

Post on 07-Sep-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

*EXAM 1 Answer key* EECS 203

Spring 2016

Name (Print): _______________Key_________________________________

uniqname (Print): ________________Key________________________________ Instructions. You have 110 minutes to complete this exam. You may have one page of notes (8.5x11.5 two-sided) but may not use any other sources of information, including electronic devices, textbooks, or notes. Leave at least one seat between yourself and other students. Please write clearly. If we cannot read your writing, it will not be graded. Honor Code. This course operates under the rules of the College of Engineering Honor Code. Your signature endorses the pledge below. After you finish your exam, please sign on the line below:

I have neither given nor received aid on this examination, nor have I concealed any violations of the Honor Code.

________________________________________________________________

Page 2: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

1. Logic (20 points) In this section, each question will have zero or more correct answers. You are to circle each

correct answer and leave uncircled each incorrect answer.

[4 points each, -1.5 per incorrect circle/non-circle, minimum 0 points per problem]

a. Circle each of the following which are equivalent to the circuit below.

¬(𝒑 ∨ (𝒒 ∧ ¬𝒓))

¬(𝒑 ∧ (𝒒 ∨ ¬𝒓))

(𝒑 ∨ (𝒒 ∧ ¬𝒓))

(¬𝒒 ∨ 𝒓) ∧ ¬𝒑

¬(¬𝒓 ∨ 𝒒) ∨ ¬𝒑

b. Circle each of the following that are satisfiable

(𝒑 ⊕ 𝒒) ∨ (𝒑 ∨ 𝒒)

(𝒑 ∧ 𝒒) → 𝑭

¬(𝒑 ∨ 𝒒) ∧ (𝒑)

𝑻 → (𝒑 ∨ 𝒒) ∧ (¬𝒑)

¬𝒑 ∧ ¬𝒒 ∧ 𝒑

c. Circle each of the following that is a tautology

(𝒑 ⊕ 𝒒) ∨ (𝒑 ∨ 𝒒)

(¬𝒑 ∧ 𝒑) → (¬𝒒 ∧ 𝒒)

¬(𝒑 ∨ 𝒒) ∧ (𝒑)

𝑻 → ((𝒑 ∨ 𝒒) ∨ (¬𝒑))

¬𝒑 ∨ ¬𝒒 ∨ 𝒑

Page 3: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

d. We define the following predicates:

i. F(x): x is Female

ii. S(x): x is a Student

iii. K(x,y): x knows y’s name

Consider the statement “Jill knows the name of every female student”.

Zero or more of the expressions below are accurate translations of this statement. Circle each of the

following that are correct.

∀𝒙(𝑲(𝑱𝒊𝒍𝒍, 𝒙) → 𝑭(𝒙) ∧ 𝑺(𝒙))

¬∃𝒙(𝑭(𝒙) ∧ 𝑺(𝒙) ∧ ¬𝑲(𝑱𝒊𝒍𝒍, 𝒙))

∀𝒙(¬𝑭(𝒙) ∨ ¬𝑺(𝒙) ∨ 𝑲(𝑱𝒊𝒍𝒍, 𝒙))

∀𝒙 ((𝑭(𝒙) ∧ 𝑺(𝒙)) → 𝑲(𝑱𝒊𝒍𝒍, 𝒙))

¬∃𝒙(𝑭(𝒙) ∧ 𝑺(𝒙) ∧ 𝑲(𝑱𝒊𝒍𝒍, 𝒙))

e. We define the following predicates:

i. F(x): x is Female

ii. S(x): x is a Student

iii. K(x,y): x knows y’s name

Consider the statement “Of all pairs of students that know each other’s names, at least one in each

pair is female”.

Zero or more of the expressions below are accurate translations of this statement. Circle each of the

following that are correct.

∀𝒙∀𝐲 ((𝑺(𝒙) ∧ 𝑺(𝒚) → (𝑲(𝒙, 𝒚) ∧ 𝑲(𝒚, 𝒙))) → (𝑭(𝒙) ∨ 𝑭(𝒚)))

∀𝒙∀𝐲(𝐒(𝐱) ∧ 𝑺(𝒚) ∧ 𝑲(𝒙, 𝒚) ∧ 𝑲(𝒚, 𝒙)) → (𝑭(𝒙) ∨ 𝑭(𝒚))

∀𝒙∀𝐲(𝐒(𝐱) ∧ 𝑺(𝒚) ∧ 𝑲(𝒙, 𝒚) ∧ 𝑲(𝒚, 𝒙)) ∧ (𝑭(𝒙) ∨ 𝑭(𝒚))

∀𝒚∃𝒙(𝐒(𝐱) ∧ 𝑺(𝒚) ∧ 𝑲(𝒙, 𝒚) ∧ 𝑲(𝒚, 𝒙)) → (𝑭(𝒙) ∨ 𝑭(𝒚))

¬∃𝒙∃𝐲(𝑺(𝒙) ∧ 𝑺(𝒚) ∧ (𝑲(𝒙, 𝒚) ∧ 𝑲(𝒚, 𝒙)) ∧ ¬(𝑭(𝒙) ∨ 𝑭(𝒚)))

Page 4: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

2. Sets (6 points) In this section, each question will have zero or more correct answers. You are to circle each

correct answer and leave uncircled each incorrect answer.

[2 points each, -1 per incorrect circle/non-circle, minimum 0 points per problem]

a. Which of the following is the power set of some set?

{{𝒂}, {}}

{{{}}, {}}

{{𝒂}, {𝒃}, {}}

{{𝒂}, {𝒃}, {𝒂, 𝒃}, {}}

b. For 𝑖 ∈ 𝑍+, 𝑙𝑒𝑡 𝐴𝑖 be the set of {0, i, i+1}. So for example, A2={0,2,3}. Which of the

following statements are a tautology?

∀𝒙∃𝒚|𝑨𝒙 ∩ 𝑨𝒚| = 𝟐

∀𝒙∀𝒚(𝑨𝒚 − 𝑨𝒙) ≠ 𝝓

{𝟏, 𝟐} − 𝑨𝟏 = {𝟏}

∀𝒙∀𝒚|𝑨𝒙 ∩ 𝑨𝒚| > 𝟎

c. Which of the following correspond to the filled-in part of the following Venn

diagram?

(𝑨 − (𝑩 − 𝑪)) ∪ (𝑩 ∩ 𝑪)

(𝑨 ∩ �̅� ∩ �̅�) ∪ (𝑩 ∩ 𝑪)

𝑩 ⊕ 𝑪̅̅ ̅̅ ̅̅ ̅̅ ̅ ∪ ((𝑨 − 𝑩) − 𝑪)

(𝑨 ∩ �̅� ∩ �̅�) ∪ (𝑨 ∩ 𝑩 ∩ 𝑪) ∪ (�̅� ∩ 𝑩 ∩ 𝑪)

Page 5: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

3. Cardinality of sets (5 points) For each of the following, circle each statement that is true (that could be zero, one, or more for

each question). Each problem is worth 1 point and you only get the points if you circle all of the

correct answers and none of the wrong ones.

a) If A and B are both uncountably infinite sets, then A-B could be

Countably infinite Uncountably infinite Finite

b) If A and B are both uncountably infinite sets, then 𝐴 ∪ 𝐵 could be

Countably infinite Uncountably infinite Finite

c) If A is a countably infinite set and B is a countably infinite set, then A-B could be Countably infinite Uncountably infinite Finite

d) (𝒁 × 𝒁 × 𝒁) – (𝑹+ × 𝑹+ × 𝑹+) is

Countably infinite Uncountably infinite Finite

e) 𝜙 × 𝑍 × 𝑅 is

Countably infinite Uncountably infinite Finite

Page 6: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

4. Growth of functions (6 points) For each of the following, circle each statement that is true (that could be zero, one, or more

for each question). Each problem is worth 2 points and you only get the points if you circle

all of the correct answers and none of the wrong ones.

a. Consider the following pseudo code: for (i:=1 to n)

for (j:= i to n/2)

if(A[j]>A[i])

A[i]:=A[i]+1 //Takes (1) time. for(i:=1 to n)

doit(i) //Takes (1) time.

This algorithm has a run time that is

(n2) O(n2) (n) (1) (n2+1)

b. Using binary search to find a specific element in a sorted list of N values has a run time that is:

(log(N)) O(N2) (N log(N)) (N2) O(N)

c. If 𝑓(𝑥) = 4𝑥 + 5 and 𝑔(𝑥) = 𝑥2 − 2, for which of the following k,C value pairs

would |𝑓(𝑥)| ≤ 𝐶|𝑔(𝑥)| for all x>k? k=3, C=2; k=2, C=3; k=1, C=4; k=4, C=1

This one was tricky because the answer depends on if the domain of f and g is the reals or the integers.

If it’s the reals none of them are true. If it’s the integers, then it’s true for k=3, C=2 and k=2 C=3. We

took either answer.

Page 7: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

5. Functions (8 points) Answer each of the following questions. Assume all functions are from R to R.

a. What is the inverse of the function, 𝑓(𝑥) = 5𝑥 + 1? [3]

𝑓−1(𝑥) =𝑥 − 1

5

b. If 𝑓(𝑥) = 3𝑥 + 4 and 𝑔(𝑥) = (0.5𝑥 + 1) what is (𝑔 ∘ 𝑓)(𝑥)? [3]

(𝑔 ∘ 𝑓)(𝑥) = 1.5𝑥 + 3

c. If f(x) is a bijection and g(x) is onto but not one-to-one, 𝑓 ∘ 𝑔(𝑥) might be (circle all

that could apply) [2]

one-to-one onto a bijection

6. Other bases (8 points) a. How many 0s are at the end of 20! when written in octal? Briefly explain your

answer. [5]

A number in octal will have a 0 at the end of it for every “8” it has as a factor. So we’ll count

the number of 2’s in the prime factorization of 20! and divide that by 3. We could count them a

number of ways, but let’s say:

Every even number has a 2.

Every multiple of 4 has a second 2.

Every multiple of 8 has a 3rd 2

Every multiple of 16 has a 4th 2.

10 (even) +5 (multiples of 4) +2 (multiples of 8) +1 (multiples of 16)=18 2s. That’s 6 zeros.

b. Convert FAD16 to base 8. [3]

FAD16=1111 1010 1101 = 76558

Page 8: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

7. Extended Euclidian Algorithm (8 points) Using the extended Euclidian algorithm, find integer values a and b such that

60𝑎 + 42𝑏 = gcd (60,42). You must clearly show your work to get credit. Place your

answer where shown.

We first find gcd(60, 42) via the Euclidean algorithm:

60 = 1(42) + 18

42 = 2(18) + 6

18 = 3(6)

and therefore we see that gcd(60, 42) = 6. Now,

6 = 42 – 2(18)

18 = 60 – 1(42)

6 = 42 – 2(60 – 1(42))

6 = -2(60) + 3(42).

Therefore, a = -2 and b = 3.

a=___-2_________ b=_____3_______

Page 9: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

8. Finding the sum of a series (6 points) Find a closed-form solution to the following summation for an arbitrary value of n using any

technique. Briefly show/explain your work.

∑ 3𝑖2 − 3(𝑖 − 1)2

𝑛

𝑖=3

If you notice this is a telescoping sequence, it very easily just becomes 3𝑛2 − 3 ⋅ 22 = 3𝑛2 − 12. If not,

we can simplify 3𝑖2 − 3(𝑖 − 1)2 = 3𝑖2 − 3𝑖2 + 6𝑖 − 3 = 6𝑖 − 3 and solve it using the identities for

summations.

9. Modular exponentiation. (5 points) Find the value of 811 𝑚𝑜𝑑 10. Show your work.

There are many ways to break 811 into smaller terms that are easier to compute. One way is 811 = 88 ⋅

82 ⋅ 8. We can compute these terms by successive squaring. 82 = 64 ≡ 4 mod 10. 84 = (82)2 ≡

42 = 16 ≡ 6 mod 10. 88 = (84)2 ≡ 62 = 36 ≡ 6 mod 10. This means 811 = 88 ⋅ 82 ⋅ 8 ≡ 6 ⋅ 4 ⋅

8 = 24 ⋅ 8 ≡ 4 ⋅ 8 = 32 ≡ 2 mod 10

Page 10: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

10. Logical arguments (8 points) Using the premises

i. 𝑝 ∨ 𝑞 → ¬𝑟

ii. (𝑝 ∨ 𝑟) ∧ 𝑞

Provide a formal deductive argument with the conclusion “p”. Justify each step.

1. 𝑞 (simplification, ii) 2. 𝑝 ∨ 𝑞 (addition, 1) 3. ¬𝑟 (modus ponens, i and 2) 4. 𝑝 ∨ 𝑟 (simplification, ii) 5. p (disjunctive syllogism, 3 and 4)

Page 11: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

11. Proof by induction (8 points) Use induction to prove that 4| (2𝑛2 + 6𝑛) for all positive integer values of n.

Theorem:∀𝒏 ≥ 𝟏, 𝟒|𝟐𝒏𝟐 + 𝟔𝒏 Proof: I will use induction on n to prove this. Base case: 2*12+6*1=8, which is divisible by 4 Induction step: Assume 4|2k2+6k for an arbitrary k 2(𝑘 + 1)2 + 6(𝑘 + 1) = 2𝑘2 + 4𝑘 + 2 + 6𝑘 + 6 = (2𝑘2 + 6𝑘) + 4(𝑘 + 2). By the inductive assumption, the first term is divisible by 4 and the second term has 4 as a factor so it is as well. This makes the sum divisible by 4, proving P(k+1)

Page 12: *EXAM 1 Answer key* - Home | EECS · This one was tricky because the answer depends on if the domain of f and g is the reals or the integers. If it’s the reals none of them are

12. Two last proofs (12 points, 6 each) a) Prove or disprove that over the domain of integers ∀𝑥 [(4|𝑥2) ∨ (4|(𝑥2 − 1)]

For all even integers, x, ∃𝑘 ∈ 𝑍, 𝑥 = 2𝑘. As (2k)2 is 4k2 and that is clearly divisible by 4.

As such 4|x2 if x is even.

For all odd integers x, ∃𝑘 ∈ 𝑍, 𝑥 = 2𝑘. +1 . As (2k+1)2 is 4k2+4k+1, for any odd x, 4|x2-1

as if we plug in for x2 we get 4|(4k2+4k+1)-1 or 4|4(k2+k) which is clearly true.

As such ∀𝑥 [(4|𝑥2) ∨ (4|(𝑥2 − 1)]

b) Find a bijection between Z+ and the integers divisible by 3.

There were a lot of fun answers to this. The most common was:

𝑓(𝑥) {

3𝑥

2 𝑖𝑓 𝑥 𝑒𝑣𝑒𝑛

−3(𝑥 + 1)

2 𝑖𝑓 𝑥 𝑜𝑑𝑑