csc 125 :: final examfaculty.kutztown.edu/rieksts/125/study/spring10/exam-ans.pdf4 28. evelyn can...

13
1 CSC 125 :: Final Exam May 3 & 5, 2010 Name ___KEY_____________________ (1 – 5) Complete the truth tables below: p Q p q p q p q p q p q T T T T F T T T F F T T F F F T F T T T F F F F F F T T 6-15. Match the following logical equivalences with the answers found in the Answer Bank. Write the correct letter just to the right of the symbol. Note: Some answers will be used more than once: 6. Identity Laws p T ≡ p p F ≡ p 7. Domination Laws p T T p F F 8. Idempotent Laws p p p p p p 9. Double Negation Law (p) p 10. Commutative Laws p q ≡ q p p q ≡ q p

Upload: others

Post on 07-Apr-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

1

CSC 125 :: Final Exam May 3 & 5, 2010

Name ___KEY_____________________

(1 – 5) Complete the truth tables below:

p Q p q p q p q p q p q

T T T T F T T

T F F T T F F

F T F T T T F

F F F F F T T

6-15. Match the following logical equivalences with the answers found in the

Answer Bank. Write the correct letter just to the right of the ≡ symbol.

Note: Some answers will be used more than once:

6. Identity Laws p T ≡ p

p F ≡ p

7. Domination Laws p T ≡ T

p F ≡ F

8. Idempotent Laws p p ≡ p

p p ≡ p

9. Double Negation Law (p) ≡ p

10. Commutative Laws p q ≡ q p

p q ≡ q p

Page 2: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

2

11. Associative Laws (p q) r ≡ p (q r)

(p q) r ≡ p (q r)

12. Distributive Laws p (q r) ≡ (p q) (p r)

p (q r) ≡ (p q) (p r)

13. DeMorgan's Laws (p q) ≡ p q

(p q) ≡ p q

14. Absorption Laws p (p q) ≡ p

p (p q) ≡ p

15. Negation Laws p p ≡ T

p p ≡ F

16-20. Fill in the missing portion of each of the rules of inference named below:

16. Modus ponens p → q

p .

q

17. Modus tollens p → q

q .

p

18. Hypothetical syllogism p → q

q → r

p → r

19. Disjunctive syllogism p q

p .

q

Page 3: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

3

20. Resolution p q

p r

q r

(21 – 26) Let B(x,y) be the statement “student x attended basketball game y,” where

the domain for x consists of all students in this class and the domain for y consists of

all basketball games this season. Match each of the quantified expressions below

with the sentences found in the Answer Bank. Write the letter of the matching

sentence just to the right of the expression.

Please note: Some answers may be used more than once.

21. xyB(x,y)

A student from this class attended a basketball game this season.

22. xyB(x,y)

≡ xyB(x,y) ≡ xyB(x,y)

Note: Equivalent to #38. No student from this class attended a basketball game this season.

{For all students and all basketball games, it not true that any student attended any game}

23. x yB(x,y)

A student from this class attended every basketball game this season.

24. x yB(x,y)

≡ xyB(x,y) ≡ xyB(x,y)

Note: Equivalent to #37. No student from this class attended every basketball game this season.

25. xyB(x,y)

Every student from this class attended a basketball game this season.

26. x yB(x,y)

Every student from this class attended every basketball game this

season.

(27 – 29) Let F(x,y) be the statement “x can fool y,” where the domain for both x

and y consists of all people in the world. Use quantifiers to express these sentences.

27. Everyone can fool Fred.

xF(x,Fred)

Page 4: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

4

28. Evelyn can fool everybody.

yF(Evelyn,y)

29. Someone can fool everybody.

xyF(x,y)

(30 – 32) Let the domain of P(x) consist of the integers 1, 2 and 3 Write out each

proposition using disjunctions, conjunctions and negations.

30. x P(x)

P(1) P(2) P(3)

31. x P(x)

P(1) P(2) P(3)

32. x P(x)

P(1) P(2) P(3)

(33 – 37) Determine whether the arguments below are valid or invalid, then circle

either Valid or Invalid. If valid, using the list of valid argument forms found in the

Answer Bank, write the letter of the rule of inference; if invalid write the letter of

the logical fallacy, again using the list of invalid argument forms found in the

Answer Bank.

33. If we get 10" of snow, school will be cancelled.

We got 8" of snow.

School will not be cancelled.

Valid Invalid

Invalid – denying the hypothesis

34. If we pigs can fly, Santa Claus is real.

Pigs can fly.

Santa Claus is real.

Valid Invalid

Valid – modus ponens {affirming the hypothesis}

35. If we pigs can fly, Santa Claus is real.

Santa Claus is not real.

Pigs cannot fly.

Page 5: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

5

Valid Invalid

Valid – modus tollens {denying the conclusion}

36. If pigs can fly, elephants can sing.

If elephants can sing, monkeys can compose music.

If pigs can fly, monkeys can compose music.

Valid Invalid

Valid – hypothetical syllogism

37. Logic is either hard or it is nutty.

Either logic is easy or it is impossible.

Logic is either nutty or it is impossible.

Valid Invalid

Valid – resolution

(38 – 41) Let A = {1, 3, 5, 6} B = {1, 2, 4, 6, 7}

38. A B = {1, 2, 3, 4, 5, 6, 7}

39. A B = {1, 6}

40. A – B = {3, 5}

41. A B = {2, 3, 4, 5, 7}

42. Let A = {a, b, c}

Give the power set of A, P(A) =

{, {a,b,c},{a}, {b}, {c}, {a,b}, {a,c}, {b,c}}

(43 – 44) Let A = {a,b,c} B = {x,y}. Find

43. A B = {(a,x), (a,y), (b,x), (b,y), (c,x), (c,y)}

Page 6: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

6

44. B B = {(x,x), (x,y), (y,y), (y,x)}

(45 – 48) Determine whether each sentence below is true or false. Circle either

True or False.

45. {a, b, c} {a, b, c} True False

46. {a, b, c} {a, b, c} True False

47. {a, b} {a, b, c} True False

48. {0} True False

(49 – 51) Determine whether each sentence below is always true or not (sometimes

false). Circle either Always True or Not Always.

49. (A B) A Always True Not Always

50. (A B) A Always True Not Always

51. A B = B A Always True Not Always

(52 – 53) Which region(s) in the Venn diagrams above represent:

52. A (B C) B C = 2,3,4,5,6,7

A (B C) = 2,4,5

Page 7: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

7

53. cmp(A) cmp(B) cmp(C)

Note: cmp(A) cmp(B) cmp(C) = cmp(A B C)

A B C = 1,2,3,4,5,6,7

cmp(A B C) = 8 = cmp(A) cmp(B) cmp(C)

(54 – 55) Give the following combinations in simplified form, if:

f(x) = (x2 – 5)

g(x) = (3x + 1)

54. (f + g) (x) =

(x2 – 5) + (3x + 1) = x2 + 3x – 4

55. (f o g) (x) =

f(g(x)) = ((3x+1)2 – 5) = 9x2 + 6x + 1 – 5 = 9x2 + 6x – 6

(56 – 57) For the questions below, the notation – n

j=0 x – represents the

summation of x as j goes from 0 to n.

(56 – 57) What are the values of these sums?

56. 5 k=0 (k+1)

(0+1) + (1+1) + (2+1) + (3+1) + (4+1) + (5+1)

= 1 + 2 + 3 + 4 + 5 + 6 = 21

57. 4 j=0 3

3 + 3 + 3 + 3 + 3 = 5*3 = 15

(58 – 59) What is the value of each of these geometric progressions?

58. 5 j=0 2

j a = 1; r = 2; n = 5 a(rn+1 – 1)/(r – 1) = 1(26 – 1)/(2 – 1) = 64 – 1 = 63

59. 4 j=0 (–3)j

a = 1; r = –3; n = 4

a(rn+1 – 1)/(r – 1) = 1((–3)5 – 1)/(–3 – 1) = (–243 – 1)/(–4) = –244/–4 = 61

(60 – 61) Compute each of these double sums.

60. 3i=1

3 j=1 (i+j)

3

i=1 (i+1) + (i+2) + (i+3) = 3

i=1 3i+6

= (3*1 + 6) + (3*2 + 6) + (3*3 + 6)

= 9 + 12 + 15 = 36

Page 8: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

8

61. 3i=0

2 j=0 (3i+2j)

3

i=0 (3i + 2*0) + (3i + 2*1) +(3i + 2*2)

= 3

i=0 (3i + 0 + 3i + 2 + 3i + 4)

= 3

i=0 (9i + 6) = (9*0 + 6) + (9*1 + 6) + (9*2 + 6) + (9*3 + 6)

= 9*6 + 4*6 = 54 + 24 = 78

62. Arrange these complexity classes in ascending order of complexity:

O(nn), O(n

b), O(n), O(1), O(n!), O(n log n), O(log n), O(b

n)

Answer::

O(1), O(log n), O(n), O(n log n), O(nb), O(b

n), O(n!), O(n

n)

63. P(9,3) =

9!/6! = 362880/720 = 504

64. C(10,4) =

10!/4!6! = 3628800/24*720 = 210

65. The 8th

line of Pascal’s triangle is given below. Give the next line.

1 7 21 35 35 21 7 1

Answer::

1 8 28 56 70 56 28 8 1

66. How many different bit strings of length 8 are there?

256

67. 144 mod 17 =

8

68. 197 mod 13 =

2

69. Give the prime factorization of 8008

23*7*11*13

70. Give the prime factorization of 1485

33*5*11

71. Give the prime factorization of 7!

24*32*5*7

72. List 3 consecutive odd integers that are all prime.

Page 9: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

9

3, 5, 7

73. How many bit strings of length 8 contain exactly 3 1's?

8*7*6/3*2*1 = 56

74. What is the minimum number of students, each of whom comes from one of the

50 states, that must be enrolled in a university to guarantee that there are at least 100

that come from the same state? 4951

75. What are the two basic components of a recursive function?

base case recursive call

76. What are the two basic components of mathematical induction?

base case

inductive step

77. What are the steps in proof by mathematical induction?

1. prove the base case 2. assume true for k

3. prove that it follows for k+1 OR:

1. prove base case, P(0) 2. prove P(k) P(k+1)

78. Give the recursive definition of factorial:

fact(n) = 1, if n = 0 n * fact(n), otherwise

79. Why is this not a circular definition?

Because:

1. n-1 < n, and therefore: 2. We are guaranteed to eventually reach the base case in the definition

80-81. Prove: The sum of two odd integers is even.

Proof: Let: a = 2k + 1

b = 2l + 1

Then:

a + b = 2k + 1 + 2 l + 1 = 2(k + l +1) EVEN

Page 10: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

10

82-83. Prove: The product of two odd integers is odd.

Proof: Let:

a = 2k + 1

b = 2l + 1

Then:

ab = (2k + 1)*(2 l + 1) = 4kl + 2k + 2l +1 =

2(2kl + k + l) + 1 ODD

84-85. Prove: For every positive integer n, there are n consecutive composite

integers. [Hint: Consider the n consecutive integers starting with (n+1)! + 2.]

Proof: 2 | (n+1)! + 2

3 | (n+1)! + 3 4 | (n+1)! + 4

5 | (n+1)! + 5 .

. n | (n+1)! + n

n+1 | (n+1)! + n+1

Thus, there are n consecutive composites.

Extra Credit

EC-1. Give the values of C and k which can be used to show that

f(x) = 3x + 7 is O(x).

C = 4; k = 7

EC-2. Give the values of C and k which can be used to show that

f(x) = x4 + 9x

3 + 5x

2 + 4x + 7 is O(x

4).

C = 5; k = 9

EC-3. How many bit strings of length 10 contain at least 4 1's?

210 – at most 3 1's = 210 – (C(10,0) + C(10,1) + C(10,2) + C(10,3)) = 1024 - (1 + 10 + 45 + 120) = 848

EC-4. How many bit strings of length 10 have an equal number of 1's and 0's?

Page 11: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

11

To be equal #-1s = #-0s = 5

So question is, how many bit strings have exactly 5 1's? C(10,5) = 252

EC-5. What is the coefficient of x5y

8 in (x + y)

13?

C(13,5) = 1287

EC-6. What is the coefficient of x7 in (x + 1)

11?

C(11,7) = 330

EC-7. What is the coefficient of y3x

5 in (3y + 2x)

8?

(3y3)(2x5)*C(8,3) = 3325*8*7*6/3*2*1 = 27*32*56 = 48384

EC-8. What is the coefficient of x9 in (2 – x)

19?

-210*C(19,9) = -210*92378 = -94,595,072

EC-9. Prove or disprove:

If a ∣ bc, with a,b & c positive integers , then either a ∣ b or a ∣ c.

DISPROOF::

by counterexample: a = 15, b =9, c = 5, bc = 45

15 ∣ 45 but 15 ∤ 9 & 15 ∤ 5

OR: a = 6, b =2, c = 9, bc = 18

6 ∣ 18 but 6 ∤ 2 & 6 ∤ 9

EC-10. Prove by mathematical induction:

n! > 2n, for all n > c, where c is some positive integer.

To Prove: n! > 2n, for all n > 3.

PROOF::

Prove base case:

4! = 24 > 16 = 24

Inductive step: Assume: k! > 2k, for all k > 3.

To prove: (k+1)!> 2k+1.

Proof: (k+1)! = (k+1)*k! > (k+1)* 2k > 2*2k = 2k+1

EC-11. Prove by mathematical induction: The sum of the first n even nonzero

integers is n(n+1). In other words, prove: n

i=1 i = n(n+1)

Page 12: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

12

PROOF::

Prove base case:

To prove: 1

i=1 i = n(n+1)

Proof: 1

i=1 i = 2*1 = 2

If n =1, then n(n+1) = 1*(1+1) = 2

Inductive step:

Assume: ki=1 i = k(k+1)

To prove: k+1

i=1 i = (k+1)[(k+1) + 1]

Proof: k+1

i=1 i = ki=1 i + 2(k+1) = k(k+1) + 2(k+1)

= (k+1)(k+2) = (k+1)[(k+1) + 1]

EC-12. Prove by mathematical induction:

n! > 25n, for all n > c, where c is some positive integer.

To Prove: n! > 25n, for all n > 65.

PROOF::

Prove base case:

65! = 8.2 x 1090 > 7.3 x 1090 = 2565

Inductive step: Assume: k! > 25k, for all k > 65.

To prove: (k+1)!> 25k+1.

Proof: (k+1)! = (k+1)*k! > (k+1)* 25k > 25*25k = 25k+1

EC-13. Prove:

For all b > 0, cb such that n! > bn, for all n > cb.

PROOF:: It is very likely that cb = ceil(2*e) is the correct value. But for a Q&D solution, cb = bb^2+b will work.

First, we look at two examples: b = 3

bb^2+b = 312

(b2 +b)! = 1*2*3*4*5*6*7*8*9*10*11*12 3*4*5 > 33

6*7*8 > 33 9 = 32

10 > 32

11 > 32

12 > 32

All together, (b2 +b)! > 32*3+4*2 = 314 > 312

Page 13: CSC 125 :: Final Examfaculty.kutztown.edu/rieksts/125/study/spring10/Exam-ans.pdf4 28. Evelyn can fool everybody. y F(Evelyn,y) 29. Someone can fool everybody. x y F(x,y) (30 – 32)

13

b = 5

bb^2+b = 530

(b2 +b)! = 1*2*3*4*5 * . . *29*30

5*6*7*8*9 > 55 10*11*12*13*14 > 55

15*16*17*18*19 > 55 20*21*22*23*24 > 55

25 = 52

26 > 52

27 > 52

28 > 52

29 > 52

30 > 52

All together, (b2 +b)! > 54*5+6*2 = 532 > 530 In general,

bb^2+b represents b multiplied by itself

b2 + b times (b2 +b)! is a number greater than b multiplied by itself

(b-1)*b + 2*(b+1) = b2 – b +2b +2 = b2 + b +2 times

Since b2 + b +2 > b2 + b, (b2 + b)! > bb^2+b