Docsity

3 Problems on Algorithm and Systems Analysis - Exam 1 | CSE 21, Exams of Computer Science

Toggle sidebar
bg1
Midterm 1, CSE21, Fall 2001
Student Name:
Instructions:
Begin by writing your name above.
This is a closed book and notes exam. You may not use calculators.
The exam contains one problem with seven questions, one problem with
nine questions and an extra credit problem. Try them all. Write your
answers on the exam sheet itself, in the assigned space below the problem,
or on the extra blank page that follows.
Suggestions:
Scan through the entire exam before beginning any ques-
tion. You don't have to do the questions in order: do rst whatever you
nd easiest. We suggest you do the extra credit problem last, due to its
diculty.
Guidelines:
Remember to write clearly: answers that don't make sense
will not get much credit. You are graded on what you write, not on what
you think you mean! So read carefully what you write. Also, indicate with a
brief note the application of the Rule of Product, Rule of Sum, and inclusion-
exclusion principle. When computing probabilities in equiprobable spaces
indicate the size of the universal set and the size of the event set.
Important Note:
For all problems answers like
n
!,
,
n
k
,
n
m
k
are
ne. HOWEVER, in multiple choices that ask for the specic number,
calculations have to be done.
Good luck!
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download 3 Problems on Algorithm and Systems Analysis - Exam 1 | CSE 21 and more Exams Computer Science in PDF only on Docsity!

Midterm 1, CSE21, Fall 2001

Student Name:

Instructions: Begin by writing your name ab ove. This is a closed b o ok and notes exam. You may not use calculators. The exam contains one problem with seven questions, one problem with nine questions and an extra credit problem. Try them all. Write your answers on the exam sheet itself, in the assigned space b elow the problem, or on the extra blank page that follows.

Suggestions: Scan through the entire exam b efore b eginning any ques- tion. You don't have to do the questions in order: do rst whatever you nd easiest. We suggest you do the extra credit problem last, due to its diculty.

Guidelines: Rememb er to write clearly: answers that don't make sense will not get much credit. You are graded on what you write, not on what you think you mean! So read carefully what you write. Also, indicate with a brief note the application of the Rule of Pro duct, Rule of Sum, and inclusion- exclusion principle. When computing probabilities in equiprobable spaces indicate the size of the universal set and the size of the event set.

Imp ortant Note: For all problems answers like n!,

n

k

, n  m  k are ne. HOWEVER, in multiple choices that ask for the sp eci c numb er, calculations have to b e done.

Go o d luck!

Scores: To b e lled in at grading time.

On Problem You got Out of

Total: 80

(e) Win 4, don't lose 1 Consider the function f from the domain set fa; b; cg to the range set f 1 ; 2 ; 3 g, such that f (a) = 1 ; f (b) = 3 ; f (c) = 3. Is the function f a i. surjection ii. injection iii. bijection iv. cannot tell given the ab ove information v. none of the ab ove (f ) Win 4, don't lose 1 Consider again the function f from the domain set A = fa; b; cg to the range set B = f 1 ; 2 ; 3 g, such that f (a) = 1 ; f (b) = 3 ; f (c) = 3. The generalized inverse f ^1 : B 7! P (A), in the two-line notation is

i. (

fag fg fb; cg

ii. (

a b c fag fg fb; cg

iii. (

a fg b c

iv. it is imp ossible to de ne v. none of the ab ove

(g) Win 4, don't lose 1 Consider two functions f and g , where f is de ned as: f (1) = 5,f (2) = 4,f (3) = 1,f (4) = 3,f (5) = 2, and g is de ned as: g (1) = 2,g (2) = 3,g (3) = 1,g (4) = 4,g (5) = 5. The (f  g ), or (f g ), is: i. (f g )(1) = 1,(f g )(2) = 2,(f g )(3) = 3,(f g )(4) = 4,(f g )(5) = 5 ii. (f g )(1) = 5,(f g )(2) = 4,(f g )(3) = 3,(f g )(4) = 2,(f g )(5) = 1 iii. (f g )(1) = 4,(f g )(2) = 1,(f g )(3) = 5,(f g )(4) = 3,(f g )(5) = 2 iv. (f g )(1) = 2,(f g )(2) = 3,(f g )(3) = 5,(f g )(4) = 1,(f g )(5) = 4 v. none of the ab ove

  1. Win 43 p oints in card games! For this problem you do not have to compute the nal numb er answers. Consider a hand of 5 cards drawn from a deck of 52 cards.

(a) 6 p oints What is the probability that the hand contains exactly 2 aces?

(b) 5 p oints What is the probability that the hand contains at least 2 aces?

(c) 3 p oints What is the probability that the hand contains exactly 2 aces, the \Queen of Diamonds" and two other cards that are not aces?

(g) 6 p oints What is the probability that the hand contains exactly 2 aces or exactly 2 kings? (Hint: It's not exclusive or)

(h) 6 p oints What is the probability that the hand contains at least 2 aces and at least 2 kings? Notice that the fth card may or may not b e an ace or a king.

(i) 6 p oints What is the probability that the hand contains 5 di erent values? A set of 5 di erent values could b e f\5 of Diamonds",
of Clubs", \2 of Diamonds", \Ace of Spades", \Queen of Clubs"g.

  1. Extra Credit Problem (9 p oints) There are 6 di erent colored pairs of so cks [1 green, 1 blue, 1 red, 1 yellow, 1 orange, 1 purple], 12 so cks in all.

 (a) 4 p oints If 2 so cks are selected at random, what is the probability that the so cks are a matching pair, that b oth are the same color?

 (b) 5 p oints If the 12 so cks are to b e distributed into 6 b oxes, each of which is to contain exactly 2 so cks, what is the probability that all b oxes contain matched pairs (ie. the red pair is in one b ox, the blue pair is in another, etc.)? (Hint: It might help to think that the b oxes are ordered)