Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CS 173: Final Exam Fall 2005, Exams of Discrete Mathematics

The final exam for a computer science course, cs 173, from the university of california, berkeley, held in fall 2005. The exam consists of multiple choice and long answer problems covering topics such as logic, sets, matrices, algorithms, and probability. The exam is divided into 17 questions, each worth a specific number of points, and the students are required to answer all questions. The exam is closed book and no notes are allowed.

Typology: Exams

2012/2013

Uploaded on 04/27/2013

atmaja
atmaja ๐Ÿ‡ฎ๐Ÿ‡ณ

4.2

(45)

182 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 173: Final Exam
Fall 2005
Name:
NetID:
Section Leader:
General Directions
1. Make sure your name is on every page.
2. There are 12 pages, including a sheet of scratch paper. Make sure that you answer all 17 questions.
3. Remember to write clearly and legibly. Unreadable answers will receive no credit.
4. This is a closed book exam. No notes of any kind are allowed.
5. Remember to time yourself.
Question Points Out of
1 5
2 5
3 5
4 5
5 5
6 5
7 5
8 5
9 5
10 5
11 5
12 5
13 20
14 20
15 20
16 15
17 15
Total 150
Page 1 of 12
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CS 173: Final Exam Fall 2005 and more Exams Discrete Mathematics in PDF only on Docsity!

CS 173: Final Exam

Fall 2005

Name:

NetID:

Section Leader:

General Directions

  1. Make sure your name is on every page.
  2. There are 12 pages, including a sheet of scratch paper. Make sure that you answer all 17 questions.
  3. Remember to write clearly and legibly. Unreadable answers will receive no credit.
  4. This is a closed book exam. No notes of any kind are allowed.
  5. Remember to time yourself.

Question Points Out of

1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 20 14 20 15 20 16 15 17 15

Total 150

Multiple Choice

Problem 1 (5pts)

One of these things is not like the others. Choose the response whose truth value is different than the other three.

a) โˆ€xโˆƒy(x + y = x)

b) โˆ€xโˆƒy(x + y = 0)

c) โˆƒyโˆ€x(x + y = x)

d) โˆƒyโˆ€x(x + y = 0)

Problem 2 (5pts)

Define the set A to be A = {x, {x}, {{x}}, {{{x}}}.. .}, and denote the power set of A by P (A). Which of the following is an appropriate choice to fill in the blank:

A โˆ’ {x} P (A)

a) =

b) โˆˆ (and not โІ)

c) โІ (and not โˆˆ)

d) โˆˆ or โІ

Problem 3 (5pts)

Suppose sets A and B are countably infinite. Which of the following is not necessarily true?

a) A โˆฉ B is countably infinite

b) A โˆช B is countably infinite

c) |A| = |Z| where Z is the set of all integers

d) |A| = |B|

Problem 6 (5pts)

Let T be the set of full binary trees, and Z be the set of all integers. Define a recursive function m : T โ†’ Z to be:

m(t) = 0 if t is a single vertex, and

m(t) = 1 + max{m(t 1 ), m(t 2 )},

where t 1 and t 2 are the left and right subtrees of t, respectively.

Full binary tree, t :

Which of the following is m(t) for tree t?

a) 3

b) 5

c) 6

d) 9

Problem 7 (5pts)

Suppose you know you will get exactly 60 or 70 or 80 points on an exam, and you know you are twice as likely to receive an 80 as a 70, and three times as likely to receive a 70 as a 60. What is your expected score on the exam?

a) 65

b) 70

c) 75

d) None of the above.

Problem 8 (5pts)

Suppose the running time of algorithm A is given by Tn = 2T n 2 + O(n), T (1) = O(1). Which of the following gives the tightest upper bound on the running time of A? (Try to do this by reasoning, rather than by solving the recurrence exactly.)

a) O(log n)

b) O(n)

c) O(n log n)

d) O(n^2 )

Problem 9 (5pts)

A group of students plans to order pizza. If 13 will eat sausage, 10 will eat pepperoni, 12 will eat olives, 4 will eat both sausage and pepperoni, 5 will eat pepperoni and olives, 7 will eat sausage and olives, and 3 will eat all three toppings, how many students are in the group?

a) 12

b) 22

c) 35

d) None of the above.

Problem 10 (5pts)

Consider the equivalence relation V on integers given by xV y if and only if x + y is even. Which of the following best describes the set of equivalence classes of V?

a) [1], [2]

b) [1], [2], [3], [4],...

c) [2], [4], [6], [8],...

d) [y], where y is any integer.

Long Answer Problems

Problem 13 (20pts)

Suppose a set A has n โ‰ฅ 2 elements and a set B has 2 elements. In this problem, we will count the number of functions f : A โ†’ B that are surjective (onto), and the number of functions g : B โ†’ A that are injective (one-to-one).

a) How many different functions f are there from A to B?

b) Describe the functions that are not onto.

c) How man functions are there of the type you described in part b?

d) How many onto functions, f : A โ†’ B, are there?

e) How many different functions g are there from B to A?

f) How many one-to-one functions, g : B โ†’ A, are there?

Problem 14 (20pts)

We define a run to be a maximal sequence of successes in a sequence of Bernoulli trials. For example, in the sequence S, S, S, F, S, S, F, F, S (where S represents success and F represents failure) there are three runs consisting of three successes, two successes, and one success, respectively. Let R denote the random variable on the set of sequences of n independent Bernoulli trials that counts the number of runs in the sequence. Find E[R], the expected number of runs in such a sequence if the probability of success on each Bernoulli trial is p, by answering the following questions.

To begin, define random variables Ij , j = 1,... , n so that Ij = 1 if a run begins at the jth Bernoulli trial, and Ij = 0, otherwise.

a) What is the probability that I 1 = 1?

b) If Ij = 1, what do you know about the j โˆ’ 1 st and jth Bernoulli trials?

c) What is the probability that Ij = 1 for j = 2,... , n?

d) Write an expression for R, the number of runs, in terms of the Ij.

e) Find E[I 1 ] using the definition of expectation of a random variable, and part a.

f) Find E[Ij ], where j = 2,... , n, using the definition of expectation, and part c.

g) Use linearity of expectation, together with parts d, e, and f, to find E[R].

Problem 16 (15pts)

a) Draw the Hasse diagram for the partial ordering โ€œx divides yโ€ on the set { 3 , 6 , 9 , 18 , 54 , 72 , 108 , 162 }.

b) Name the minimum element, if it exists.

c) Name the minimal elements, if any exist.

d) Name the maximum element, if it exists.

e) Name the maximal elements, if any exist.

f) Give all lower bounds for the set { 72 , 108 }, if any exist.

g) Give the greatest lower bound for the set { 72 , 108 }, if it exists.

Problem 17 (15pts)

Solve the following recurrence:

an = 5a n 2 โˆ’ 6 a n 4 + n 4 a 1 = 3, a 2 = 9