BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) Question Paper 2079 Nepal
This is the official BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) question paper for 2079, as set in the regular annual examination. It carries 100 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Simulation and Modeling (PU, CMP 338) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) exam or solving previous years' question papers, this 2079 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt all / any as specified.
(a) Define a system and explain the difference between the system environment and the system entities, illustrating your answer with a suitable example such as a bank or a manufacturing shop. (6)
(b) Models used in a simulation study can be classified as physical vs. mathematical, static vs. dynamic, deterministic vs. stochastic and discrete vs. continuous. With one concrete example for each pair, explain these classifications and state which class of model a discrete-event simulation belongs to. (8)
(a) System, system environment and system entities (6)
System: A system is a group of objects that are joined together in some regular interaction or interdependence toward the accomplishment of some purpose. Example: a bank serving customers, or a manufacturing shop producing parts.
System entities: The objects of interest inside the system whose behaviour we study. They have attributes (properties) and take part in activities.
System environment: Everything outside the system boundary that influences the system but is not controlled by it. Changes in the environment affect the system but the system does not (significantly) affect them. The line that separates the two is the system boundary.
Example — a bank:
| Concept | In a bank |
|---|---|
| Entities | Customers, tellers (servers) |
| Attributes | Customer arrival time, account type; teller busy/idle |
| Activities | Making a deposit, serving a customer |
| Events | Arrival of a customer, completion of service |
| System | The set of tellers + the queue of customers |
| Environment | The wider economy, weather, a nearby event that changes the arrival rate |
In a manufacturing shop, entities are machines and jobs; the environment is the demand/order stream and raw-material supply that drive the system but are external to it.
(b) Classification of models (8)
| Pair | Meaning | Concrete example |
|---|---|---|
| Physical vs. Mathematical | Physical = a tangible/scaled replica; Mathematical = symbols & equations representing the system. | Physical: a wind-tunnel scale model of an aircraft. Mathematical: for population growth. |
| Static vs. Dynamic | Static = system at a single point in time (no time axis); Dynamic = system evolves over time. | Static: a Monte Carlo estimate of . Dynamic: a bank queue evolving minute by minute. |
| Deterministic vs. Stochastic | Deterministic = no randomness, fixed inputs give fixed outputs; Stochastic = contains random variables. | Deterministic: chemical reaction with known rate. Stochastic: customer arrivals following a Poisson process. |
| Discrete vs. Continuous | Discrete = state changes only at discrete instants; Continuous = state changes continuously with time. | Discrete: number of customers in a queue. Continuous: water level in a tank governed by a differential equation. |
Class of a discrete-event simulation (DES): A DES model is dynamic, stochastic and discrete — the state variables change only at a discrete (countable) set of points in time (the event times), the model evolves over time, and arrivals/service times are typically random.
Marking scheme: (a) definition of system 2, environment vs. entities 2, worked example 2; (b) ~1 mark per correctly explained pair with example (4×1.5 ≈ 6) + 2 for stating DES is dynamic/stochastic/discrete.
A single-server queuing system (M/M/1) is to be analysed by hand simulation. The following inter-arrival times and service times (in minutes) are given for the first 8 customers:
| Customer | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Inter-arrival time | - | 3 | 2 | 5 | 1 | 4 | 2 | 6 |
| Service time | 4 | 2 | 5 | 1 | 3 | 2 | 4 | 2 |
(a) Construct a simulation table showing arrival time, service-begin time, waiting time, service-end time and time the customer spends in the system for each customer. (8)
(b) From your table, compute the average waiting time per customer, the probability that a customer has to wait, the average service time, and the server utilization. (6)
(a) Hand-simulation table (8)
Arrival time = cumulative inter-arrival times (customer 1 arrives at t=0). Service begin = max(own arrival time, previous customer's service-end). Waiting time = service begin − arrival time. Service end = service begin + service time. Time in system = service end − arrival time.
Arrival times: 0, 3, 5, 10, 11, 15, 17, 23.
| Cust | Inter-arr | Arrival | Service time | Service begin | Wait in Q | Service end | Time in system |
|---|---|---|---|---|---|---|---|
| 1 | - | 0 | 4 | 0 | 0 | 4 | 4 |
| 2 | 3 | 3 | 2 | 4 | 1 | 6 | 3 |
| 3 | 2 | 5 | 5 | 6 | 1 | 11 | 6 |
| 4 | 5 | 10 | 1 | 11 | 1 | 12 | 2 |
| 5 | 1 | 11 | 3 | 12 | 1 | 15 | 4 |
| 6 | 4 | 15 | 2 | 15 | 0 | 17 | 2 |
| 7 | 2 | 17 | 4 | 17 | 0 | 21 | 4 |
| 8 | 6 | 23 | 2 | 23 | 0 | 25 | 2 |
Totals: total waiting time in queue = min; total service time = min; total time in system = min.
(b) Performance measures (6)
Average waiting time per customer min.
Probability a customer has to wait (customers 2,3,4,5 waited).
Average service time min.
Server utilization (server finishes the last customer at t=25; it was busy 23 of those 25 minutes — note the only idle gap is between t=21 and t=23).
Average time a customer spends in the system min (supporting figure).
Marking scheme: correct arrival/begin/end columns 4, wait & system columns 4; each of the four part-(b) statistics 1.5 each.
(a) Describe the linear congruential method for generating pseudo-random numbers and state the conditions (Hull–Dobell theorem) under which a mixed congruential generator achieves the maximum (full) period. (6)
(b) Using the multiplicative congruential generator with seed , generate the first six random integers and the corresponding uniform random numbers. Comment on the period obtained and why it is not full. (6)
(a) Linear congruential method (LCG) and Hull–Dobell conditions (6)
The linear congruential generator produces a sequence of integers in by the recurrence
where is the modulus (), the multiplier (), the increment () and the seed. Uniform numbers are obtained by .
If it is a mixed congruential generator; if it is multiplicative.
Hull–Dobell theorem (full period for a mixed LCG): A mixed congruential generator has the maximum possible period for every seed if and only if
- and are relatively prime, i.e. ;
- is divisible by every prime factor of ;
- is divisible by 4 if is divisible by 4.
(b) Multiplicative generator , seed (6)
| 0 | 3 | 15 | 15 | 0.9375 |
| 1 | 15 | 75 | 11 | 0.6875 |
| 2 | 11 | 55 | 7 | 0.4375 |
| 3 | 7 | 35 | 3 | 0.1875 |
| 4 | 3 | 15 | 15 | 0.9375 |
| 5 | 15 | 75 | 11 | 0.6875 |
First six generated integers: 15, 11, 7, 3, 15, 11 with uniforms 0.9375, 0.6875, 0.4375, 0.1875, 0.9375, 0.6875.
Comment on the period: The sequence repeats after the values — i.e. the period is 4, not the maximum. For a multiplicative generator with ( here), the maximum achievable period is only , and it is reached only when or and the seed is odd. Because is a power of two, a full period of 16 is impossible for a multiplicative () generator (the Hull–Dobell full-period conditions require ); even numbers can never appear once an odd seed is used, so at most odd residues are visited and the period is short.
Marking scheme: (a) recurrence + parameter meaning 3, three Hull–Dobell conditions 3; (b) correct six values 4, correct comment on period 2.
(a) State and prove the inverse-transform technique for generating a random variate from a continuous distribution with cumulative distribution function . (5)
(b) Using the inverse-transform method, derive the formula for generating an exponential random variate with rate . Given and a random number , compute the corresponding variate. (5)
(a) Inverse-transform technique — statement and proof (5)
Statement: Let be a continuous random variable with cumulative distribution function that is continuous and strictly increasing. Let . Then the variate
has the distribution function .
Proof: Since is continuous and strictly increasing it has an inverse . Consider the CDF of :
where we applied (an increasing function) to both sides. Because is uniform on , for , and . Hence
Thus has exactly the desired distribution .
Algorithm: (1) generate ; (2) set .
(b) Exponential variate by inverse transform (5)
The exponential CDF with rate is
Set and solve for :
Since is also , this is equivalently written .
Numerical evaluation with and (using the standard form ):
So the generated exponential variate is approximately (time units).
Marking scheme: (a) statement 1, correct proof using 4; (b) derivation of 3, correct numeric answer 2.
Section B: Short Answer Questions
Attempt all / any as specified.
Explain the steps in a sound simulation study, from problem formulation to documentation and implementation, using a flow diagram. At which step are verification and validation carried out?
Steps in a sound simulation study (7)
The accepted sequence (Banks, Carson, Nelson & Nicol) is:
- Problem formulation — clearly state the problem.
- Setting of objectives and overall project plan — questions to answer, resources, time.
- Model conceptualization — abstract the system into a model.
- Data collection — gather input data (often concurrent with step 3).
- Model translation — code the model in a simulation language/package.
- Verified? — verification: is the program a correct implementation of the conceptual model? If no, return to model translation.
- Validated? — validation: does the model accurately represent the real system? Often compared against a real system; if no, return to model conceptualization / data collection.
- Experimental design — decide replications, run length, scenarios.
- Production runs and analysis — run the model, analyse output.
- More runs? — if yes, go back to step 8.
- Documentation and reporting — record assumptions, program, and results.
- Implementation — put the results into practice.
Flow diagram (described in words): boxes flow top-to-bottom 1→2→3 and 4 (3 and 4 side-by-side) →5→ Verified? (decision) → Validated? (decision) →8→9→ More runs? (decision) →11→12. The two decision diamonds loop back: "Verified? No" loops to model translation; "Validated? No" loops to model conceptualization; "More runs? Yes" loops to experimental design.
Where V&V occur: Verification is carried out right after model translation (step 6) to confirm the code matches the conceptual model; Validation is carried out at step 7, calibrating the model against the real system before production runs.
Marking scheme: correct ordered list of steps 4, flow-diagram/loops shown 2, correctly identifying the V&V step 1.
Describe the Monte Carlo method. Using it, set up the procedure to estimate the value of by simulating random points in a unit square, and state how the accuracy of the estimate depends on the number of samples.
Monte Carlo method (7)
The Monte Carlo method is a technique that uses repeated random sampling to obtain numerical estimates of quantities that may be deterministic (e.g. an integral, an area, or ) but are hard to compute analytically. By generating many random samples and averaging an appropriate outcome, the law of large numbers makes the estimate converge to the true value. It is typically a static, stochastic simulation (no time axis).
Estimating
Consider a quarter circle of radius 1 inscribed in the unit square . The square has area 1; the quarter circle has area . So the probability that a uniformly random point in the square falls inside the circle is .
Procedure:
count = 0
for i = 1 to N:
x = U(0,1) # random x
y = U(0,1) # random y
if x*x + y*y <= 1: # inside quarter circle
count = count + 1
pi_estimate = 4 * count / N
The fraction of points inside, , estimates , hence .
Accuracy vs. number of samples
The estimate is the mean of Bernoulli trials, so its standard error decreases as
To halve the error you must quadruple . Thus Monte Carlo converges slowly (), but the rate is independent of dimension, which is its great advantage for high-dimensional problems.
Marking scheme: definition of Monte Carlo 2, procedure/code with ratio 3, accuracy 2.
For an M/M/1 queue with arrival rate customers/hour and service rate customers/hour, compute: (a) the server utilization , (b) the expected number of customers in the system , and (c) the expected waiting time in the queue .
M/M/1 queue, /hr, /hr (6)
(a) Server utilization
The server is busy 80% of the time.
(b) Expected number in system
(c) Expected waiting time in queue
Using customers and Little's law :
Equivalently hr.
Marking scheme: (a) 2, (b) 2, (c) hr (24 min) 2.
Distinguish between verification and validation of a simulation model. List any four techniques that can be used to increase the validity and credibility of a model.
Verification vs. Validation (6)
| Aspect | Verification | Validation |
|---|---|---|
| Question answered | "Are we building the model right?" | "Are we building the right model?" |
| Concern | The computer program correctly implements the conceptual model (debugging). | The conceptual model is an accurate representation of the real system. |
| Compares | Program output vs. intended model logic. | Model output vs. the real system's behaviour/data. |
| When | During model translation/coding. | After verification, against reality. |
In short, verification checks the model is implemented correctly, while validation checks the right model has been built (it behaves like the real system).
Four techniques to increase validity and credibility (any four)
- Use high face validity — build a model that, on the surface, looks reasonable to people knowledgeable about the system (involve subject-matter experts).
- Validate model assumptions — test structural and data assumptions statistically against real data.
- Compare model output with real-system data — run the model under the same conditions as the real system and statistically compare results (e.g. confidence-interval or t-test on key measures).
- Sensitivity analysis — vary input parameters to see whether the model responds in the same direction/magnitude as the real system.
(Other acceptable answers: animation/trace, historical-data validation, Turing test with experts, degenerate/extreme-condition tests.)
Marking scheme: clear V vs. V distinction 2 (1 each), any four valid techniques 4 (1 each).
Explain why generated random numbers must be tested. Describe the Kolmogorov–Smirnov test for uniformity and state how the test statistic is compared with the critical value to accept or reject the hypothesis.
Why random numbers must be tested (6)
Numbers from a generator are pseudo-random — produced by a deterministic algorithm. Before use they must be tested to confirm they are:
- Uniformly distributed on , and
- Independent (no autocorrelation/pattern).
If they fail these properties the simulation results are biased or invalid, so statistical tests for uniformity (frequency/, Kolmogorov–Smirnov) and independence (runs, autocorrelation) are applied.
Kolmogorov–Smirnov (K–S) test for uniformity
The K–S test compares the empirical CDF of the generated numbers with the theoretical uniform CDF on .
Procedure:
- Arrange the numbers in ascending order: .
- Compute the largest deviations above and below the theoretical CDF:
- The test statistic is
Decision rule: Look up the critical value from the K–S table for the chosen significance level and sample size .
- If : do not reject — the numbers are consistent with a uniform distribution.
- If : reject — the hypothesis of uniformity is rejected.
Marking scheme: reasons for testing (uniformity & independence) 2, K–S statistic with formulae 2, comparison rule vs 2.
Differentiate between terminating (transient) and steady-state (non-terminating) simulations with an example of each. Explain why the replication–deletion approach and a warm-up period are needed when analysing steady-state output.
Terminating vs. steady-state simulation (6)
| Terminating (transient) | Steady-state (non-terminating) | |
|---|---|---|
| Definition | Runs from a well-defined start to a natural terminating event; interest is in behaviour over that finite period. | Runs (conceptually) forever; interest is in long-run / steady-state behaviour, independent of initial conditions. |
| Initial state | Specific, meaningful initial condition. | Initial condition is artificial and should not bias results. |
| Example | A bank that opens at 9 am and closes at 4 pm — simulate one day; or simulating a single battle/mission. | A continuously running telephone exchange or a 24×7 manufacturing line, where we want long-run utilization. |
Why replication–deletion and a warm-up period are needed
In a steady-state study the output at the start of a run is influenced by the (usually empty/idle) initial conditions, producing initialization bias — early observations are not representative of steady state.
- Warm-up period (deletion): discard the data collected during the initial transient period (e.g. using Welch's procedure), so statistics are gathered only after the system has reached steady state. This removes initialization bias.
- Replication–deletion approach: make independent replications (different random-number streams), in each replication delete the warm-up data, compute the steady-state average of the remaining data, and then use these replication averages as i.i.d. observations to form a point estimate and a confidence interval for the steady-state measure.
Together they give an unbiased steady-state estimate with a valid confidence interval, which a single long run cannot easily provide.
Marking scheme: correct distinction with one example each 3, role of warm-up (initialization bias) 1.5, replication–deletion for CI 1.5.
Define the following terms used in discrete-event simulation: (a) event, (b) event notice, (c) future event list (FEL), (d) system state, and (e) activity. Briefly explain how the simulation clock advances in the event-scheduling approach.
Discrete-event simulation terms (6)
(a) Event: An instantaneous occurrence that may change the state of the system. Examples: an arrival, the completion of a service.
(b) Event notice: A record (data structure) stating that a particular event is to occur at a given future time, e.g. (event type, event time, associated entity). It is the entry placed on the FEL.
(c) Future Event List (FEL): A list of all event notices for events scheduled to occur in the future, ordered by event time (earliest first). The simulation always removes the most imminent event from the head of this list.
(d) System state: The collection of state variables that completely describe the system at any time (e.g. number of customers in queue, server status busy/idle).
(e) Activity: A duration of time of known length (specified when it begins), such as a service time or an inter-arrival time. It corresponds to the interval between two related events.
How the simulation clock advances (event-scheduling / next-event approach)
The clock uses next-event time advance: rather than ticking in fixed steps, the simulation jumps directly to the time of the next (most imminent) event on the FEL.
While FEL not empty:
1. Remove the imminent event notice (smallest event time) from the FEL.
2. Advance the simulation clock to that event time.
3. Execute the event routine: update system state and statistics.
4. Possibly schedule new future events (insert notices into the FEL).
Thus the clock advances unevenly, skipping over periods of inactivity in which no state change occurs.
Marking scheme: five definitions 1 mark each (5), clock advance via next-event mechanism 1.
The average customer delay obtained from 5 independent replications of a queuing simulation is 4.2, 5.1, 3.8, 4.6 and 4.9 minutes. Construct a 95% confidence interval for the mean delay (use ).
95% confidence interval for mean delay (6)
Data (n = 5): 4.2, 5.1, 3.8, 4.6, 4.9 minutes.
Sample mean:
Deviations and squared deviations:
| 4.2 | -0.32 | 0.1024 |
| 5.1 | 0.58 | 0.3364 |
| 3.8 | -0.72 | 0.5184 |
| 4.6 | 0.08 | 0.0064 |
| 4.9 | 0.38 | 0.1444 |
| Sum | 1.1080 |
Sample variance and standard deviation:
Standard error:
Half-width (with ):
95% confidence interval:
We are 95% confident the true mean customer delay lies between about 3.87 and 5.17 minutes.
Marking scheme: mean 1, variance/SD 2, standard error 1, half-width using t 1, final interval 1.
Frequently asked questions
- Where can I find the BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) question paper 2079?
- The full BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) 2079 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the Simulation and Modeling (PU, CMP 338) 2079 paper come with solutions?
- Yes. Every question on this Simulation and Modeling (PU, CMP 338) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
- How many marks is the BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) 2079 paper?
- The BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) 2079 paper carries 100 full marks and is meant to be completed in 180 minutes, across 12 questions.
- Is practising this Simulation and Modeling (PU, CMP 338) past paper free?
- Yes — reading and attempting this Simulation and Modeling (PU, CMP 338) past paper on Kekkei is completely free.