CS
1538 – Fall 2009 – Practice Questions and Guidelines for Midterm Exam
There will be two parts to the midterm exam:
1) A closed book section consisting of fill in the blanks, true / false, short answer and some other miscellaneous problems. For this section no notes, text or calculators will be allowed. Once this section is completed, hand it in and I will give you the open book section below.
2) An open book section consisting of problem-solving questions. These will be similar to some of your homework problems and problems that we did in class. For these you will likely need some of the formulas in the text (esp. those in Section 5.3, Section 5.4 Section 6.3 and Section 6.4). You may also use any handouts and/or Web documents that were referenced. However, you may NOT use your computer, so PRINT OUT anything you think you will need. You may also use a calculator for these problems but you should NOT use any programming nor have any formulas already entered into the calculator. If it is found that you violated this policy you will receive a 0 for the exam.
Below is an explanation of the types of questions and an example problem or two for each type. The solutions follow in the latter part of this document. I strongly recommend giving the problems a good try before looking at the solutions. Note that the problems shown are only example problems and are not necessarily representative in number of the questions that will actually be on the exam. Thoroughly read over the Review Sheet to see the material that you need to know for this exam.
CLOSED BOOK PROBLEMS
Fill in the Blanks and True/False – these problems will deal mainly with definitions and possibly simple computations. For false questions you will be expected to explain WHY they are false.
1. In the ______________________________ simulation model inputs to the simulation are known values, while in the _____________________________ simulation model, one or more random variables are used for input data.
2. The future-event list (FEL) is typically represented by a ______________________________, which can be efficiently implemented using a _______________________________.
3. Given a sequence of Bernoulli trials, if X represents the number of trials required until the first success, the distribution for X is called a ________________________________________.
4. The exponential distribution has the memoryless property, meaning that _________________________________________________________________________.
5. Given an M/M/1 queueing system, the Ms mean ____________________________ and the 1 means _______________________________.
6.
7. (T/F) An M/M/1 queuing system with l = 3 and μ = 2 is stable.
8. (T/F) The multiplicative congruential generator Xi+1 = (3Xi) mod 232 will have a period of 232.
Short Answer – these problems will typically include definitions, comparisons and explanations. There may be some calculations, but most of the calculations will be in the Problem Solving below.
1. Compare the two approaches below for clock maintenance in a simulation:
a. Next-event time advance
b. Fixed-increment time advance
For each explain the general idea and what if any advantages and disadvantages each has.
2. State the Conservation Law of queueing theory (Little's Equation) and define each variable in the equation.
3.
The following is known about random number generator R:
it has a period of 248 and it uses all values within the range.
Is this necessarily a good random number generator? If not, give an EXAMPLE of a generator that
will meet the criteria above but that is NOT a good random number generator.
Miscellaneous – problems here may include simple traces, writing small code segments or other problems that don't fit into the other 3 categories.
1.
Consider the following HEAP stored as an array: 10 20 40 30 50 60 45 80 70 55
Show the resulting array after the operation removeMin() has been performed
on the heap. Show your work!
OPEN BOOK PROBLEMS
Problem Solving – these problems will be similar in nature to the exercises assigned in your Written Assignments as well as some examples done in class (ex: from Chapters 5 and 6). They will involve use of formulas / equations / procedures that we discussed in lecture as well as some problem-analyzing and problem-solving skills. For these problems you will be able to use your textbook, calculator and printouts, but not your computer. Be sure to bring your textbook to the exam!
I have not included the formulas for the problems below because part of
the problem is to deter
1. The time intervals between dial-up connections to an Internet Service Provider are exponentially distributed with a mean of 15 seconds. Find the probability that the third dial-up connection occurs after 30 seconds have elapsed.
2.
Suppose the mechanics arrive randomly at a tool crib
according to a Poisson process with rate l = 10 per hour. It is known that the single tool clerk serves
a mechanic in 4
SOLUTIONS
Don't look below until you have given all of the problems a GOOD try!
CLOSED BOOK PROBLEMS
Fill in the Blanks and True / False
1.
In the _____deter
2. The future-event list (FEL) is typically represented by a ________priority-queue________, which can be efficiently implemented using a _________heap__________________.
3. Given a sequence of Bernoulli trials, if X represents the number of trials required until the first success, the distribution for X is called a _____geometric distribution_____________.
4. The exponential distribution has the memoryless property, meaning that __P(X>s+t | X>s) = P(X>t)____________.
5. Given an M/M/1 queueing system, the Ms mean ___exponentially distributed data__ and the 1 means ___a single server __.
6.
7. (T/F) An M/M/1 queuing system with l = 3 and μ = 2 is stable. FALSE – To be stable the ratio l/μ must be < 1.
8. (T/F) The multiplicative congruential generator Xi+1 = (3Xi) mod 232 will have a period of 232. FALSE – since the mod value is a power of two, this generator cannot have a period larger than 230 (which may or may not be attained here).
Short Answer
1. Compare the two approaches below for clock maintenance in a simulation:
a. Next-event time advance
b. Fixed-increment time advance
For each explain the general idea and what if any advantages and disadvantages each has.
Answer: See the powerpoint lecture slides
2.
State the Conservation Law of queueing
theory (Little's Equation) and define each variable in the equation.
Answer: L = lw. See text and lecture slides for definitions
of L, l and w.
3.
The following is known about random number generator R:
it has a period of 248 and it uses all values within the range
Is this necessarily a good random number generator? If not, give an EXAMPLE of a generator that
will meet the criteria above but that is NOT a good random number generator.
Answer: This generator is NOT necessarily
good – we know nothing about the uniformity and independence of the values
generated. For example, the simple
generator: Xi+1 = (Xi + 1) mod 248 will have a
period of 248 and will certainly produce all values within the
range. However, it is a very poor
generator!
Miscellaneous – problems here may include simple traces, writing small code segments or other problems that don't fit into the other 3 categories.
1.
Consider the following HEAP stored as an array: 10 20 40 30 50 60 45 80 70 55
Show the resulting array after the operation removeMin() has been
performed on the heap. Show your work!
Answer: Recall that removeMin() will replace the root of the heap (A[0]) with the last
leaf (A[n-1]). In the case above, this
would yield:
55 20 40 30 50 60 45 80 70
We then need to do a "Down Heap" to push 55 back into its correct
location. Comparing 55 to its children,
20 and 40 we see that 20 is the smallest and will be swapped with 55, yielding
20 55 40 30 50 60 45 80 70
Repeating the process, we compare 55 with its children, 30 and 50 and will swap
55 and 30, yielding
20 30 40 55 50 60 45 80 70
Repeating again, we compare 55 with its children, 80 and 70 and, since 55 is
the smallest, we stop.
OPEN BOOK PROBLEMS
Problem Solving
1.
The time intervals between hits on a web page from
remote computers are exponentially distributed with a mean of 15 seconds. Find the probability that the third hit
connection occurs after 30 seconds have elapsed.
Answer: This is problem 5.25 from the
text. If X is the time between dial up
connections, the result is an Erlang distribution
with kq = 1/15 and k = 3. A hint to this is that it asks about the
"third dial-up", which implies a sequence of exponential
arrivals. F(30)
will give us the probability that the 3rd connection occurs by 30
seconds, and 1 – F(30) will give us the probability that we want. Plugging into formula 5.39 (see p. 196) gives
us 1 – 0.323 = 0.677
2. Suppose
the mechanics arrive randomly at a tool crib according to a Poisson process
with rate l
= 10 per hour. It is known that the
single tool clerk serves a mechanic in 4
Answer: This is problem 6.7 from the
text. Since we don't know the service
distribution, we will model this with an M/G/1 queue with l = 10/hr, m = (1
/ 4 min)(60min/hr) = 15/hr, s2
= [(2min)(1hr/60min)]2 = (1/30)2 hr2, r = l/m =
2/3.
The average cost associated with a single mechanic waiting for tools is equal
to the hourly pay of the mechanic times the average time spent in the queue
waiting for tools ( = 15wq).
Overall, we need to multiply this value by the hourly rate of mechanics co
15lwq
Using Table 6.3 from the text we can plug in the values to obtain wq = 0.08333.
We can then obtain our final answer of $12.50 through simple
multiplication. Note that this does not
take into account the time during which the mechanics are actually being
served. In that case, we would want to
use w rather than wq