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

Midterm Exam Problems - Simulation | CSCI 426, Exams of Computer Science

Material Type: Exam; Professor: Smirni; Class: Simulation; Subject: Computer Science; University: William and Mary; Term: Fall 2008;

Typology: Exams

Pre 2010

Uploaded on 03/11/2009

koofers-user-7iu-1
koofers-user-7iu-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSci 426/526 Simulation Fall 2008
Midterm Exam
Take-Home Portion
This exam is due at the beginning of class (2:00pm) on Tuesday, November 4 and will not be accepted late
without prior approval. Graduate students must work all three problems; undergraduate students must work
problem 1 and either of the remaining two problems.
You may not seek or receive assistance on this test from any person other than me. Failure to observe this
rule will be treated as an honor code violation.
Problem 1: [20 points] Mr. K is the manager of a new Snowball Express sno-cone stand which will be
opening for business. The stand is operated by a single attendant who is behind a window. People come up
to the window, tell the attendant which flavor sno-cone they want, wait for the attendant to fill their order,
then pay and leave. When there is more than one customer at the window, a line forms so that customers
are served in the order that they arrived. People always buy one and only one sno-cone at $3 each. The
cost of materials to make sno-cones is negligible, so Mr. K considers all of the money taken in to be profit,
except that the attendant has to be paid from the money received.
After interviewing several applicants for the attendant’s position, Mr. K has narrowed his choice to two
people: Fran and Bill. Fran can complete a transaction (take the order, make the sno-cone, take payment
and make change) in 20 seconds on the average. Bill can perform the same job in 30 seconds, on the average.
Fran is faster than Bill but demands $12 per hour, whereas Bill will work for $6 per hour.
Market research has revealed that, on the average, Mr. K can expect one customer per minute to come up
to the window. The research also shows that if a customer comes to the window and there are already N
people in line, then the customer will promptly turn about in a huff and storm off to Ben and Jerry’s.
Studies of real sno-cone stands have further shown that, even though the average customer arrival rate is
one per minute, usually the amount of time between customers is less than that. It’s the occasional lull in
business that makes the average time between customers longer than that which is usually observed. The
same is true of the time it takes to make sno-cones. Thus, assume that the time between customer arrivals
and the time it takes a person to make a sno-cone are exponentially distributed random values.
(a) For both Fran and Bill, and based on 1 000 000 served customers, construct a table of the estimated
steady-state probability that a customer will go to Ben and Jerry’s when the number of people in line N
is 1, 2, 3, 4, and 5. (b) Construct similar tables if the time to serve a customer for Fran is changed to be
Uniform(5, 35) and the time to serve a customer for Bill changed to be Uniform(15,45). (c) Comment on how
the probability of rejection (i.e., the probability to go to Ben and Jerry’s) depends on the service process.
(d) Assuming exponentially distributed service times for both Fran and Bill, if Nis equal to 3, which person
is the more cost-effective to hire: Fran or Bill? For this part of the problem provide also analytical solutions.
(e) Discuss what you did to convince yourself that your results are correct.
Problem 2: [20 points] According to the ANSI C standard, the type unsigned long is guaranteed to
support integers in the range 0,1,...,232 1.
Modify algorithm 2.2.1 such that it never produces an integer outside of the range (0,1,...,m).
How many full-period multipliers are there for m= 232 135?
For m= 232 135, how many full–period, modulus compatible multipliers are there? What are the
ten smallest?
Find the smallest full–period, modulus compatible multiplier a100,000 for mo dulus m= 232 135.
For this (a,m) pair, construct a table of maximal modulus-compatible jump multipliers (similar to
example 3.2.6) for 1024, 512, 256, 128, 64, and 32 streams.
pf2

Partial preview of the text

Download Midterm Exam Problems - Simulation | CSCI 426 and more Exams Computer Science in PDF only on Docsity!

CSci 426/526 — Simulation — Fall 2008

Midterm Exam

Take-Home Portion

This exam is due at the beginning of class (2:00pm) on Tuesday, November 4 and will not be accepted late without prior approval. Graduate students must work all three problems; undergraduate students must work problem 1 and either of the remaining two problems.

You may not seek or receive assistance on this test from any person other than me. Failure to observe this rule will be treated as an honor code violation.

Problem 1: [20 points] Mr. K is the manager of a new Snowball Express sno-cone stand which will be opening for business. The stand is operated by a single attendant who is behind a window. People come up to the window, tell the attendant which flavor sno-cone they want, wait for the attendant to fill their order, then pay and leave. When there is more than one customer at the window, a line forms so that customers are served in the order that they arrived. People always buy one and only one sno-cone at $3 each. The cost of materials to make sno-cones is negligible, so Mr. K considers all of the money taken in to be profit, except that the attendant has to be paid from the money received. After interviewing several applicants for the attendant’s position, Mr. K has narrowed his choice to two people: Fran and Bill. Fran can complete a transaction (take the order, make the sno-cone, take payment and make change) in 20 seconds on the average. Bill can perform the same job in 30 seconds, on the average. Fran is faster than Bill but demands $12 per hour, whereas Bill will work for $6 per hour. Market research has revealed that, on the average, Mr. K can expect one customer per minute to come up to the window. The research also shows that if a customer comes to the window and there are already N people in line, then the customer will promptly turn about in a huff and storm off to Ben and Jerry’s. Studies of real sno-cone stands have further shown that, even though the average customer arrival rate is one per minute, usually the amount of time between customers is less than that. It’s the occasional lull in business that makes the average time between customers longer than that which is usually observed. The same is true of the time it takes to make sno-cones. Thus, assume that the time between customer arrivals and the time it takes a person to make a sno-cone are exponentially distributed random values. (a) For both Fran and Bill, and based on 1 000 000 served customers, construct a table of the estimated steady-state probability that a customer will go to Ben and Jerry’s when the number of people in line N is 1, 2, 3, 4, and 5. (b) Construct similar tables if the time to serve a customer for Fran is changed to be Uniform(5, 35) and the time to serve a customer for Bill changed to be Uniform(15,45). (c) Comment on how the probability of rejection (i.e., the probability to go to Ben and Jerry’s) depends on the service process. (d) Assuming exponentially distributed service times for both Fran and Bill, if N is equal to 3, which person is the more cost-effective to hire: Fran or Bill? For this part of the problem provide also analytical solutions. (e) Discuss what you did to convince yourself that your results are correct.

Problem 2: [20 points] According to the ANSI C standard, the type unsigned long is guaranteed to support integers in the range 0, 1 ,... , 232 − 1.

  • Modify algorithm 2.2.1 such that it never produces an integer outside of the range (0, 1 ,... , m).
  • How many full-period multipliers are there for m = 2^32 − 135?
  • For m = 2^32 − 135, how many full–period, modulus compatible multipliers are there? What are the ten smallest?
  • Find the smallest full–period, modulus compatible multiplier a ≥ 100 , 000 for modulus m = 2^32 − 135. For this (a, m) pair, construct a table of maximal modulus-compatible jump multipliers (similar to example 3.2.6) for 1024, 512, 256, 128, 64, and 32 streams.

Problem 3: [20 points] A test is compiled by selecting 12 different questions, at random and without replacement, from a well-publicized list of 120 questions. After studying this list you are able to classify all 120 questions into two classes, I and II. Class I questions are those about which you feel confident; the remaining questions define class II. Assume that your grade probability, conditioned on the class of the problems, is

A B C D F class I 0.6 0.3 0.1 0.0 0. class II 0.0 0.1 0.4 0.4 0.

Each test question is graded on an A = 4, B = 3, C = 2, D = 1, F = 0 scale and a score of 36 or better is required to pass the test. (a) If there are 90 class I questions in the list, use Monte Carlo simulation and 100 000 replications to generate a discrete-data histogram of scores. (b) Based on this histogram what is the probability that you will pass the test?

Evgenia Smirni, 10-20-