Download Midterm COMP 2804

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Non-standard calculus wikipedia , lookup

Birthday problem wikipedia , lookup

Infinite monkey theorem wikipedia , lookup

Addition wikipedia , lookup

Law of large numbers wikipedia , lookup

Elementary mathematics wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
Midterm COMP 2804
March 2, 2016
1. What is the coefficient
of x31 y 9 in the expansion of (4x − 6y)40 ?
Answer: − 40
· 431 · 69
9
2. Let S = {1, 2, 3, 4, 5, 6, 7, 8}. You choose a uniformly random 6-element subset X of S. Thus,
each 6-element subset of S has a probability of 1/ 86 of being X. Define the event
A = “6 is an element of X”
What is Pr(A)?
Answer: 3/4
3. Let S be a collection of 6 positive and 8 negative numbers, where none of the numbers
is 0. We draw 4 numbers from S, and multiply them (note that the numbers are drawn
without replacement). What is the probability that the product of the four drawn numbers
is positive.
8×(63)+6×(83)
Answer: 1 −
(144)
4. How many different strings of length 11 that can be formed by reordering the letters of the
11-letter word:
M ISSISSAU GA
7 5 3 2 1
Answer: 11
4
2 2 1 1 1
5. How many solutions are there to the inequality x1 + x2 + x3 + x4 ≤ 20, where x1 ≥ 0, x2 ≥ 0,
x3 ≥ 0, and x4 ≥ 0 are integers?
Answer: 24
4
(See Theorem 3.9.2 in Michiel’s Notes)
6. The Board of Directors of ABC non-profit organization consists of a President, two VicePresidents, and a 7-person Advisory Board. The President cannot be Vice-President and
cannot be on the Advisory Board. A Vice-President cannot be on the Advisory Board. Let n
be the number of possible members to choose the Board of Directors for ABC, where n ≥ 10.
In how many wayscan a Board of Directors be chosen?
Answer: (n − 9) n2 n−2
7
1
7. Let S be a set of 20 elements and let x, y, and z be three distinct elements of S. What is
the number of subsets of S that contain both x and y, but do not contain z?
Answer: 217
8. For integers m ≥ 0, n ≥ 0, r ≥ 0, m ≥ r, and n ≥ r, the expression
r X
m
n
k
r−k
k=0
equals to
Answer:
m+n
r
9. Let A be a set of 5 elements and let B be a set of 12 elements. How many one-to-one (i.e.,
injective) functions f : A → B are there?
Answer: 8 · 9 · 10 · 11 · 12
10. For any integer n ≥ 2, let Sn be the number of bitstrings of length n in which the first two
bits are the same. Which of the following is true?
Answer: Sn = 2n−1
11. Consider strings of length 20 consisting of the characters a, b, and c. How many such strings
are there that start with abc or end with bbb?
Answer: 2 · 317 − 314
12. In any sequence of 50 distinct real numbers, there is always an increasing or a decreasing
subsequence, whose length is at least:
Answer: 8
13. An elementary school class contains 7 boys and 8 girls. If two students are selected at random
to represent the class, what is the probability that they are of different sexes?
Answer: 8/15
14. An elementary school class contains 7 boys and 8 girls. On two separate occasions a student
is selected at random to represent the class. What is the probability that the two choices
result in children of different sexes?
Answer: 112/225
15. Consider the following recursive definition of a function f : N → N, where N is the set of
natural numbers
f (0) = 5
f (n) = 2f (n − 1) + 4, if n ≥ 1.
What is f (n)?
Answer: f (n) = 9 × 2n − 4
2
16. The function f : N → N is defined by
f (0) = 5
f (n) = f (n − 1) + 2n − 3 for n ≥ 1
What is f (n)?
Answer: f (n) = n2 − 2n + 5
17. Consider the following recursive algorithm Fib, which takes as input an integer n ≥ 0:
Algorithm Fib(n):
if n = 0 or n = 1
then f = n
else f = Fib(n − 1) + Fib(n − 2)
endif;
return f
When running Fib(10), how many calls are there to Fib(5)?
Answer: 8
3
4
5