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: Midterm Exam 2 - Spring 2006, Exams of Discrete Mathematics

This is a closed book exam for cs 173 with 13 problems covering various topics in combinatorics, recursion, and mathematical induction. It includes multiple-choice questions, short answer problems, and a recursive function definition. The problems require a solid understanding of set theory, counting principles, and mathematical proof techniques.

Typology: Exams

2012/2013

Uploaded on 04/27/2013

atmaja
atmaja 🇮🇳

4.2

(45)

182 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 173: Midterm Exam 2
Spring 2006
Name:
NetID:
Lecture Section: 9:30a, 11:00a (circle one)
Section Leader:
General Directions
1. Make sure your name is on every page.
2. Remember to write clearly and legibly. Unreadable answers will receive no credit.
3. This is a closed book exam. No notes of any kind are allowed. No calculators.
4. 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 10
10 10
11 10
12 10
13 20
Total 100
Page 1 of ??
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CS 173: Midterm Exam 2 - Spring 2006 and more Exams Discrete Mathematics in PDF only on Docsity!

CS 173: Midterm Exam 2

Spring 2006

Name:

NetID:

Lecture Section: 9:30a, 11:00a (circle one)

Section Leader:

General Directions

  1. Make sure your name is on every page.
  2. Remember to write clearly and legibly. Unreadable answers will receive no credit.
  3. This is a closed book exam. No notes of any kind are allowed. No calculators.
  4. Remember to time yourself.

Question Points Out of

Total 100

Multiple Choice

Problem 1 (5pts)

What is n if C(n, 3) = P (n, 2)?

a) (^196)

b) 8

c) There is no positive value of n that makes this equation true.

d) Some other positive value of n makes this equation true.

Solution: (^) (n−n3)!3!! = (^) (n−n!2)! ⇒ n(n−1)( 6 n−2)= n(n 2 − 1)⇒ n(n − 1) n− 6 8 = 0 (b)

Problem 2 (5pts)

What is the coefficient of x^5 in (3x + 12 )^8?

a) 21

b) (^42 )

c) (^354 )

d) 1701

Solution:

8

(1/2)^335

(d)

Problem 5 (5pts)

A box contains 10 French books, 20 Spanish books, 8 German books, 15 Russian books, and 25 Italian books. Suppose we randomly select books from boxes so that each book is equally likely to be chosen. How many books must we choose from the boxes in order to be sure of choosing 12 books of the same language?

a) 52

b) 56

c) 57

d) 60

Solution: In the worst case, we choose one from each kind until German books are all chosen. Then choose one from each remaining kind until French books are eliminated. Then, do it again until the number of a certain kind reaches

  1. In total, it is 5 × 8 + 4 × 2 + 3 × 1 + 1 = 52. (a)

Problem 6 (5pts)

A sushi bar sells five kinds of rolls, and you want to eat nine rolls for dinner. How many different sushi dinners do you have to choose from if you must have one roll of each type? (Note, the arrangement of the sushi on your plate is irrelevant.)

a) 54

b) 59

c) 9!4!

d)

4

Solution: basically you select 4 sushi rolls: 54. (a)

Problem 7 (5pts)

At a party, each card in a standard deck of 52 unique cards is torn in half and both halves are placed in a box. Two guests each draw a half-card from the box. What is the probability they draw 2 halves of the same card?

a) 521

b) 2061

c) 1031

d) 10352

Solution: Randomly choose one from a box, the chance that its other half is drawn from the other box is 521. (a)

Problem 8 (5pts)

A directory on a computer’s hard drive contains 12 files, 3 of which are corrupted by a virus. If a corrupted file is selected, the virus is removed and another file is selected at random from the 12 files. That is, a file may be accessed more than once, but after the first time, it is certainly not corrupt.

Find the probability that exactly three selections are made until an uncorrupted file is chosen. In other words, find the probability the first two selections are corrupted, and the third is not.

a) 1

b) 28811

c) 643

d) 4

Solution: 3 / 12 ∗ 2 / 12 ∗ 11 /12 = 11/ 288 (b)

Problem 10 (10pts)

Define a recursive function listmax() whose input is a finite set of integers Ln = {x 1 , x 2 ,... , xn} with n ≥ 2 , and whose output is the maximum element in the set. You may assume the existence of a function max({a, b}) whose input is a list of length 2, and whose output is the maximum element of the list.

Solution:

function listMax(list l) if(l.length==1) return l[0]; else return max(l[0],listMax(l.removeFirstElement())

Grading rubric: 2 points for stopping condition. 8 points recusrive formula. 1 point out of 10 for nonrecursive solution.

Problem 11 (10pts)

Consider the Fibonacci Sequence: f 0 = 0, f 1 = 1, and fn = fn− 1 + fn− 2 , for n ≥ 2. In this problem you will prove that fn > A · ( 32 )n^ when n ≥ 1 , for some constant A.

a) Find a value of A that makes the expression true.

b) As the base case of an inductive argument, prove that f 1 > A · 32 and f 2 > A · ( 32 )^2 , where A is the value you chose in part a). (Think about why both these base cases are necessary.)

c) Complete the proof by induction.

Solution

a) f 1 = 1 > 32 A ⇒ A < (^23) f 2 = f 0 + f 1 = 1 > 94 A ⇒ A < (^49) Try A = 13.

b) f 1 = 1 > 32 × 13 = 12 ⇒ True f 2 = f 0 + f 1 = 1 > 94 × 13 = 34 ⇒ True

c) Inductive Hypothesis: Assume for 1 ≤ k ≤ n, it is true that fk > 13 · ( 32 )k^ (Since you have two base cases, it is also correct if you assume only for k = n − 1 and k = n, it is true that fk > 13 · ( 32 )k). Inductive Step: For k = n + 1, fn+1 = fn + fn− 1 > 13 · ( 32 )n^ + 13 · ( 32 )n−^1 = ( 13 + 29 )( 32 )n^ = 59 ( 32 )n^ = 1027 ( 32 )n+1^ > 13 ( 32 )n+

Grading Criteria

a) 2 points.

b) 2 points.

c) 6 points. No IH or seriously flawed inductive step: -3 or -4 points; IH not strong enough (only assumes k=n is true, etc.): -2 points Minor errors: -1 or -2 points

Problem 13 (20pts)

You are most likely getting hungry by now, so we’re going to count sandwiches. Suppose the local Freeway Sandwich Shop has 6 different kinds of meat, 3 different kinds of cheese, 12 different kinds of vegetable, and 2 different kinds of bread. Note that because of our discriminating tastes, sandwiches whose ingredients are stacked in different orders are considered to be different sandwiches, even if the ingredient list is the same. Moreover, the sandwich makers at Freeway are very good–they always remember to put the bread on the outside of the sandwich. DON’T FORGET THESE FACTS!

a) Suppose you want a cheese (only) sandwich on white bread. How many different sandwiches do you have to choose from if you want 6 slices of cheese? (Duplicate cheese slice types are allowed.)

b) If you randomly choose sandwiches like those in part a), how many different sandwiches would you have to choose in order to assure that you choose at least 3 that are exactly the same?

c) How many different sandwiches can be made from 3 slices of turkey, 2 slices of cheddar cheese, and one onion (a vegetable)? (Don’t forget to think about the bread!)

d) If you prefer that your sandwiches be stacked in order–meats first, then cheeses, then veggies–how many italian- bread sandwiches consist of a stack of 3 different meats, followed by 2 different cheeses, followed by one veggie?

e) How many of the sandwiches you counted in part d) have stacks that begin with turkey and roast beef?

f) What is the probability of selecting a sandwich like those in part e) if you choose one randomly from those in part d)?

SCRATCH PAPER