CIS 66 – Midterm 1 Last Name (print) Spring 2002 ssn (last 4 digits) First (Name print) ____________________________ __ __ __ __ ____________________________ Signature ____________________________ 1. (20 points) Compute the following - the result must be a number log2(64*1024) _________ log4(64) _________ The bitwise result of ((1000) (1010)) (0101) _________ 200 j = 21 J _________ If set A = {{a, b, c}}, what is |A| _________ If set A = {{a, b, c}}, what is |P(A)| _________ If set A = {{a, b, c}} and set B = {1, 2, 3}, how many elements are in the set AB? _________ Compute -94/10 _________ The prime factorization of 36. __________________________ The prime factorization of 3600. __________________________ GCD(1000001, 1000) (that’s 1,000,001 and 1,000) _________ GCD(22*3*5*7, 2*32*5) _________ LCM(22*3*5, 2*32*5) _________ Convert A11 (base 16) to decimal. _________ Convert A11 (base 16) to binary. ____ ____ ____ 1. (20 points) Compute the following - continued Convert 65 decimal to binary. _________ Convert 65 decimal to base 8. _________ -45 mod 100 _________ What decimal number does the 8-bit, 2’s complement number 10100001 represent? _________ What decimal number does the 8-bit, 1’s complement number 10100001 represent? _________ 2. (20 points) Circle the correct answer propositions: If 1 + 1 = 3, then 1 + 1 = 2 True False propositions: x y Px,y ( y x Px,y) True False propositions: jZ kZ (j = k2) True False propositions: pp tautology contradiction contingency propositions: (pq) (q p) tautology contradiction contingency propositions: (pq) pq tautology contradiction contingency sets: {x} {{x}} True False sets: {{}} {{x}} True False sets: (1, a) A B where A = {1, 2}, B = {a, b} True False sets: A(BC) (AB)AB True False Summations N+1 j=3 j-1 = n-1 k=1 k+1 True False 2. (20 points) Circle True or False, continued -x = - x True False 3x3 + 5x + 2 is O(x!) True False If a, b, and c are integers and a | b and a | c, then a| (b + c) True False If A and B are n by n matrices, AB = BA. True False -36 | -72 True False 1,000,001 and 100 are relatively prime. True False Problems that are polynomial worst-case complexity are tractable. True False y = x + 1, xZ, yZ (the integers) injection surjection bijection y = x*2, xZ, yZ (the integers) injection surjection bijection 3. (10 points) Create a truth table for the proposition [(p q) (qr)] (p r) p T T T T F F F F q T T F F T T F F r T F T F T F T F 4. (5 points) Define the following sets by listing their elements if A, B, C, and D are defined as follows. A = {a, b, c, d} B = {a, c, e, g} C = {b, d, f} D = {a, b} AC = {_______________________________________________} AB = {_______________________________________________} P(D) = {_______________________________________________} CD = {_______________________________________________ } AD = {_______________________________________________ } 5. (10 points) Find the indicated functions when f(x) and g(x) (from R to R) are defined as follows: f(x) = x2 + 2 g(x) = 2x + 3 (fg)(x) ____________________________________ (ff)(x) ____________________________________ (fg)(x) ____________________________________ (f+g)(x) ____________________________________ (g-1)(x) ____________________________________ f(x) is an injection (one to one). True false f(x) is an surjection (onto). True false g(x) is an injection (one to one). True false g(x) is an surjection (onto). True false 6. (10 points) Assume a, b, and c are integers. Show (prove) that, if a|b and a|c, then a|(b+c). 7. (10 points) Assume matrices A, B, and C are defined as follows. Compute AB – 2C. A= 3 1 -2 2 B= 1 0 3 1 C= 2 2 -3 1 8. (10 points) Provide the best possible big O estimate (that is, a big Theta estimate) for each of the following functions f(x) = (3 x3 + 4x2+ 5 x + 2)*(x + log x) ______ f(x) = (3 x3 + 4x2+ 5 x + 2)/( log x + x2) ______ f(x) = (3 x3 + 4x2+ 5 x + 2)*( log xx + x2) ______ f(x) = (x!)*(xx)*(x) ______ f(x) = (xx + x2x + 5x)(x! + 5x) ______ 9. (10 points) Provide the best possible big-O estimate for f(x) = x3 + 5x2 log x + x2 + log xx. Then show (prove) that your answer is in fact a big-O estimate.