csc 125 :: final exam - kutztown university of...

15
1 CSC 125 :: Final Exam December 14, 2011 1-5. Complete the truth tables below: p q p q p q p q p q p q T T T F F T F F (6 – 9) Let p be: Log rolling is fun. q be: The sawmill is closed. Express these as English sentences: 6. p q 7. q p Write these propositions using p and q and logical connectives: 8. The sawmill is not closed but logrolling is fun. 9. If logrolling is not fun then the sawmill is not closed.

Upload: vankhanh

Post on 08-Mar-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

1

CSC 125 :: Final Exam December 14, 2011

1-5. Complete the truth tables below:

p q p q p q p q p q p q

T T

T F

F T

F F

(6 – 9) Let

p be: Log rolling is fun.

q be: The sawmill is closed.

Express these as English sentences:

6. p q

7. q p

Write these propositions using p and q and logical connectives:

8. The sawmill is not closed but logrolling is fun.

9. If logrolling is not fun then the sawmill is not closed.

2

(12 – 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:

12. Domination Laws p T ≡

p F ≡

13. Identity Laws p T ≡

p F ≡

14. DeMorgan's Laws (p q) ≡

(p q) ≡

15. Negation Laws p p ≡

p p ≡

(16 – 18) Fill in the missing portion of each of the rules of inference named below:

16. Modus ponens (affirming the hypothesis) p → q

.

q

17. Modus tollens (denying the conclusion)

q .

p

18. Hypothetical syllogism p → q

.

p → r

3

(19 – 22) 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.

19. Freedom is precious and fragile.

Freedom is fragile.

Valid Invalid

Argument form:

20. If Tyler has bronchitis, then has a fever.

Tyler has a fever.

Tyler has bronchitis.

Valid Invalid

Argument form:

21. Sam is really smart.

Sam is really smart and he gets good grades.

Valid Invalid

Argument form:

22. 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

Argument form:

(23 – 24) Let the domain of P(x) consist of the integers 1, 2 and 3. Write out each

proposition using disjunctions, conjunctions and negations.

23. x P(x)

24. x P(x)

4

(25 – 32) Let S(x) be the statement “person x stands during the 7th

inning stretch,”

where the domain for x consists of all persons who go to baseball games.

(25 – 28) Write the sentence which renders the logical expression into colloquial

English.

25. x S(x)

26. x S(x)

27. x S(x)

28. x S(x)

(29 – 32) Render the sentences below as logical expressions, using predicates and

quantifiers.

29. Some stand during the 7th inning stretch.

30. Some do not stand during the 7th

inning stretch.

31. Not everyone stands during the 7th inning stretch.

32. Micah stands during the 7th

inning stretch.

5

(33 – 35) 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.

33. Everyone can fool Fred.

34. Someone can fool everybody.

35. No one can fool him- or herself.

(36 – 43) Let D(x,y) be the statement “student x does homework assignment y,”

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

consists of all homework assignments.

(36 – 39) Render these logical expressions into colloquial English.

36. xy D(x,y)

37. x y D(x,y)

38. xy D(x,y)

39. yx D(x,y)

(40 – 43) Write the logical expression – using nested quantifiers – for each sentence

below.

40. Some students did some of the assignments.

41. No one did every assignment.

6

42. Some did every assignment.

43. Dana did not do any assignment.

(44 – 46) Match the following set identities – write the letter of the correct answer

found in the Answer Bank.

44. Identity Laws A =

A U =

45. Domination Laws A U =

A =

46. DeMorgan's Laws cmp(A B) =

cmp(A B) =

(47 – 50) Let A = {1, 3, 5, 7}

B = {1, 2, 7} C = { 2, 6, 8}

47. A B =

48. A – B =

49. A – (B C) =

50. A B =

7

51. Let

A = {1, 2, 3}

Give the power set of A.

P(A) =

52. Let

A = {a,b,c} B = {x,y}

A B =

(53 – 58) Circle True or False

53. x{x} True False

54. x {x} True False

55. {x} {x} True False

56. {} True False

57. {} True False

58. { {} True False

(59 – 61) Let the universal set, U, and the sets A and B be as follows:

U = {a, b, c, d, e, f, g, h}, and

A = {a, c, e, f} B = {b, c, e, g}

59. Give the bit string for A B.

60. Give the bit string for A B.

61. Give the bit string for the complement of A.

8

(62 – 65) Compute the value of these expressions involving the floor and ceiling

functions.

62. 5/2

63. 5/2

64. 5/2

65. 5/2

(66 – 68) What is the cardinality of each of these sets, assuming a and b are distinct

elements?

66. P({a})

67. P({a, b})

68. P()

(69 – 71) For each function defined below, determine whether it is one-to-one, onto,

both, or neither.

69. Let

A = {a, b, c, d}

B = {1, 2, 3}

f : A B

f(a) = 3; f(b) = 2; f(c) = 1; f(d) =2

70. Let

A = {a, b, c}

B = {1, 2, 3}

f : A B

f(a) = 3; f(b) = 1; f(c) = 2

71. Let

A = {a, b, c}

B = {1, 2, 3, 4}

f : A B

9

f(a) = 2; f(b) = 1; f(c) = 3

(72 – 75) Determine for each function f: Z Z whether it is one-to-one, onto,

neither or both:

72. f(n) = n – 1

73. f(n) = n2 +1

74. f(n) = n3

75. f(n) = n/2

(76 – 78) What are the terms a0, a1, a2, and a3, of the sequence {an}, where an

equals:

76. 2n + 5*3n

77. 2n – (–2)n

78. 2n/3

(79 – 82) For the questions below, the notation:: n

j=0 x represents the summation

of x as j goes from 0 to n.

(79 – 80) What are the values of these sums?

79. 5

k=0 (k+3)

80. 4

j=0 2j

(81 – 82) Compute each of these double sums.

81. 4

i=0 3

j=1 (i – j)

10

82. 3

i=0 2

j=0 (2i+3j)

83. Let S = {1, 2, 4, 7}

What is j S (j2 – 2j)?

84. Arrange the Big-O categories below in ascending order O(n), O(n log n), O(n

n), O(n

k), O(b

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

85. What is the runtime Big-O classification of GenPerms?

86. What is the space usage Big-O classification of GenPerms?

87. If GenPerms were run on an input of abcdefghijklmnopqrstuvwxyz would the run

time be best expressed in seconds, minutes, hours, days, weeks, months, years or

centuries?

88. State the number theory theorem that allowed us to greatly reduce both the time

and the space required for modular exponentiation.

89. Find a div m and a mod m when: a = 228, m 119

90. Find a div m and a mod m when: a = 9009, m = 223

91. List all the integers between -20 and +20 that are congruent to 4 modulo 7.

92. (455 mod 23 + 173 mod 23) mod 23 =

11

93. (455 mod 23 * 173 mod 23) mod 23 =

(94 – 105) You may use the number bases table in the Appendix.

94-96. Convert from decimal to binary, octal and hexadecimal: 231

97-99. Convert from binary to octal, hexadecimal, and decimal: 10010012

100-102. Convert from octal to binary, hexadecimal, and decimal: 3258

103-105. Convert from hexadecimal to binary, octal, and decimal: AB516

106. Give the prime factorization of 88

107. Give the prime factorization of 14553

108. Which positive integers < 20 are relatively prime to 20?

109. Give the gcd of 37*5

3*7

3 and 2

11*3

5*5

9

110. Give the lcm of of 37*5

3*7

3 and 2

11*3

5*5

9

12

111. There are 13 math majors and 127 CS majors. In how many ways can you pick

2 reps such that 1st is a math major and 2

nd is a CS major?

112. There are 13 math majors and 127 CS majors. In how many ways can you pick

one who is either a math major or a CS major?

113. How many different 3 letter initials can people have?

114. How many bit strings are there of length 8?

115. How many bit strings are there of length 12 that both begin and end with 1?

116. How many bit strings of length 10 are palindromes?

117. How many ways are there to seat 6 people around a circular table if two

seatings are the same as long as each person has the same right and left neighbor?

118. How many bit strings of length 10 either begin with 3 zeros or end with 2

zeros?

119. Out of a bowl with 10 red and 10 blue balls, how many must you select to be

sure to have 3 of the same color?

120. Out of a bowl with 10 red and 10 blue balls, how many to be sure you have at

least 3 blue ones?

121. How many students must be enrolled at a university in order to guarantee that at

least 1000 come from the same state?

13

122. List all permutations of {a, b, c}.

123. How many different permutations are there of {a, b, c, d, e, f, g}?

14

(124 – 127) Give the value of these r-permutations and r-combinations:

124. P(6,3)

125. P(8,5)

126. C(6,3)

127. C(8,5)

128. How many possibilities for win, place & show in a race with 12 horses?

129. How many bit strings of length 10 contain exactly four 1s?

130. How many bit strings of length 10 contain at most four 1s?

131. A coin is flipped 10 times. How many possible outcomes are there in total?

132. A coin is flipped 10 times. How many possible outcomes contain exactly 2

heads?

133. What is the probability that a fair die never comes up even when it is rolled 6

times?

Extra Credit

EC-1. Give the probabilities, when rolling a pair of fair dice, of rolling each of the

sums 2, 3, 4, . . , 10, 11, 12.

EC-2. Suppose you have a pair of loaded dice. On one die 2 is twice as likely to

come up as any of the other numbers. On the other die, 5 is 3 times as likely to come

up as any other number. What sum is most likely to occur? Why?

15

EC-3. How many zeros are at the end of 10000!

EC-4. List all the twin primes between 100 and 200.

EC-5. Consider the base 32 number system. As with hexadecimal we can use letters

of the alphabet for the values 10, 11, etc. [Use instead of the letter O which looks

too much like the digit 0].

a. What is the largest digit you will have to represent? What letter will be

used to represent it?

b. Give the binary, octal, hexadecimal and decimal representation of

CPU32.

c. of R2D232.

d. Give the base 32 representation of 9090910.

EC-6. We know that 2/5 in base 10 is the terminating decimal 0.4, while 1/3 is the

repeating decimal 0.3333. It turns out that in base 2 the fraction ½ is the terminating

“binimal” 0.1, but 2/5 is the repeating one 0.011001100. It stands to reason that in

base 6 the fraction 1/6 terminates, since the denominator is the base itself. On the

other hand, 2/5 repeats as it did in base 2 – 0.222.

Give some other examples of fractions that terminate in base 10 but repeat in

base 6;

that terminate in base 6 but repeat in base 10;

that terminate in both base 6 and base 10;

that repeat in both base 6 and base 10.

What about fractions in base 7 vis a vis base 10?