BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) Question Paper 2078 Nepal
This is the official BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) question paper for 2078, 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 2078 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 state of a system, an entity, an attribute, an activity and an event with suitable examples drawn from a bank teller service. (7)
(b) Classify models on the basis of (i) static vs. dynamic, (ii) deterministic vs. stochastic and (iii) continuous vs. discrete. Where does a Monte Carlo model and where does a discrete-event simulation model fall in this classification? (5)
(c) List any three situations where simulation is the appropriate tool and two situations where simulation should not be used. (3)
(a) System and its components (7)
A system is a collection of entities (people, machines, objects) that act and interact together toward the accomplishment of some logical end. The behaviour of a system is characterised by the following terms (illustrated with a bank teller service):
| Term | Definition | Bank-teller example |
|---|---|---|
| State of the system | The collection of variables necessary to describe the system at any instant of time, relative to the objectives of the study. | Number of busy tellers + number of customers waiting in queue. |
| Entity | An object of interest in the system. | A customer or a teller. |
| Attribute | A property (characteristic) of an entity. | A customer's account balance or priority; a teller's speed. |
| Activity | A time period of specified length (a duration the system stays in some condition). | Serving a customer (the service time). |
| Event | An instantaneous occurrence that may change the state of the system. | Arrival of a customer; completion of service (departure). |
Distinction: an activity spans an interval of time and ends with an event (an instant), whereas an event changes the state. Entities possess attributes.
(b) Classification of models (5)
- (i) Static vs. Dynamic: A static model represents a system at a particular point in time (no time axis), e.g. Monte Carlo. A dynamic model represents the system as it evolves over time.
- (ii) Deterministic vs. Stochastic: A deterministic model has no random inputs (output fixed once inputs are known); a stochastic model contains one or more random inputs, so outputs are themselves random.
- (iii) Continuous vs. Discrete: In a continuous model state variables change continuously with time (differential equations); in a discrete model state changes only at discrete (countable) points in time.
Placement:
- A Monte Carlo model is static, stochastic (and typically discrete in the sense of not modelling time evolution).
- A discrete-event simulation model is dynamic, stochastic, discrete.
(c) When to use / not use simulation (3)
Appropriate (any three):
- When the system is too complex for an analytical (closed-form) solution.
- To study a proposed system before building it / to compare design alternatives.
- To verify analytic results, or to study a system over a long time frame in compressed time ("what-if" experimentation).
Should NOT be used (any two):
- When the problem can be solved exactly by simple analytical methods (e.g. a known queuing formula).
- When the cost/time of building the model exceeds the benefit, or when there is no time/resources/valid data to model and validate it.
A single-channel queuing system (single server, FIFO) receives customers whose inter-arrival times and service times (in minutes) are to be hand-simulated.
Inter-arrival times: 0, 2, 4, 1, 2, 6, 1, 3, 2, 1
Service times: 2, 1, 3, 2, 1, 4, 2, 5, 1, 3
(a) Construct the simulation table showing clock time of arrival, service-begin time, service-end time, waiting time in queue and time the server is idle for all 10 customers. (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. (5)
(c) Explain how the event-scheduling / time-advance algorithm advances the simulation clock in a discrete-event simulation, and contrast it with the fixed-increment time-advance approach. (3)
(a) Simulation table (8)
Arrival clock = running sum of inter-arrival times. Customer 1 starts at clock 0. Service begins at max(arrival, previous service-end). Idle time = arrival of a customer − service-end of previous customer (when positive).
| Cust | Inter-arr | Arrival | Service time | Service begin | Service end | Wait in queue | Server idle |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 2 | 0 | 2 | 0 | 0 |
| 2 | 2 | 2 | 1 | 2 | 3 | 0 | 0 |
| 3 | 4 | 6 | 3 | 6 | 9 | 0 | 3 |
| 4 | 1 | 7 | 2 | 9 | 11 | 2 | 0 |
| 5 | 2 | 9 | 1 | 11 | 12 | 2 | 0 |
| 6 | 6 | 15 | 4 | 15 | 19 | 0 | 3 |
| 7 | 1 | 16 | 2 | 19 | 21 | 3 | 0 |
| 8 | 3 | 19 | 5 | 21 | 26 | 2 | 0 |
| 9 | 2 | 21 | 1 | 26 | 27 | 5 | 0 |
| 10 | 1 | 22 | 3 | 27 | 30 | 5 | 0 |
Totals: total waiting in queue = 0+0+0+2+2+0+3+2+5+5 = 19 min; total service time = 2+1+3+2+1+4+2+5+1+3 = 24 min; total idle = 3+3 = 6 min; simulation ends at clock = 30 min.
(b) Performance measures (5)
- Average waiting time per customer = 19 / 10 = 1.9 min.
- Probability a customer waits = (number who waited) / 10 = 5/10 = 0.5.
- Average service time = 24 / 10 = 2.4 min.
- Server utilization = total busy time / total run time = 24 / 30 = 0.8 (80%). (Server idle 6 of 30 min.)
(c) Time-advance mechanisms (3)
Event-scheduling / next-event time-advance: the simulation clock is initialised to 0 and the times of future events are kept in an event (future-event) list. The clock then jumps directly to the time of the most imminent (smallest-time) event; that event is processed, the state and statistical counters are updated, new future events are scheduled, and the clock advances again to the next imminent event. Periods of inactivity are skipped.
Fixed-increment time-advance: the clock is advanced in equal steps Δt, and at the end of each step all events scheduled to have occurred in that interval are processed (treated as if they happened at the interval end).
Contrast: next-event advance moves only to instants where the state actually changes (efficient, exact event timing), whereas fixed-increment advance steps even through empty intervals and introduces round-off of event times; the latter is mainly suited to continuous/synchronous systems.
(a) Using the linear congruential method with multiplier a = 17, increment c = 43, modulus m = 100 and seed X₀ = 27, generate the first five random numbers and the corresponding U(0,1) values. Comment on the achievable period of this generator. (6)
(b) State the conditions (Hull–Dobell theorem) under which a linear congruential generator achieves the maximum period m. (4)
(c) Derive the inverse-transform algorithm for generating a random variate from an exponential distribution with mean 1/λ, and use U = 0.25 to generate one exponential variate for λ = 0.5. (5)
(a) Linear congruential generator (6)
Recurrence: with , and .
- ,
- ,
- ,
- ,
- ,
Sequence: 2, 77, 52, 27, 2, … with U-values 0.02, 0.77, 0.52, 0.27, 0.02.
Period comment: , so the sequence repeats with period 4 — far below the maximum possible . The Hull–Dobell conditions are not met (e.g. is not a multiple of every prime factor of 100; in particular not of 5), so this is a poor generator.
(b) Hull–Dobell theorem — maximum period (4)
A mixed LCG with attains the full period iff:
- and are relatively prime (i.e. );
- is divisible by every prime factor of ;
- If is a multiple of 4, then is also a multiple of 4.
(c) Inverse-transform for the exponential (5)
The exponential cdf is . Set and invert:
Since is also , one often uses .
Algorithm: (1) generate ; (2) return .
Numerical: :
(a) Distinguish clearly between verification and validation of a simulation model. Describe any four techniques used to verify a simulation program. (7)
(b) What is meant by the transient (warm-up) period in a steady-state simulation, and why must it be handled before output analysis? Briefly describe Welch's method for determining the warm-up length. (4)
(c) Explain the difference between terminating and non-terminating (steady-state) simulations with one example of each. (3)
(a) Verification vs. Validation (7)
- Verification — "Did we build the model right?" It concerns the programming/computer model: checking that the conceptual model has been correctly translated into a working computer program (debugging).
- Validation — "Did we build the right model?" It concerns whether the model is an accurate representation of the real system for its intended purpose (comparing model behaviour with the real world).
Four techniques to verify a simulation program (any four):
- Have the program/model checked (read/reviewed) by more than one person (structured walkthrough).
- Make the flow of the program logic as self-documenting and modular as possible, and trace it for a few simple cases by hand.
- Use a trace — print out the state, clock and event list step by step and compare with hand calculations.
- Run the model under simplifying assumptions with known analytic results (e.g. exponential service so M/M/1 formulas apply) and compare.
- Use animation to watch the dynamic behaviour and spot logical errors.
(b) Transient (warm-up) period (4)
In a steady-state simulation the system starts from an artificial empty-and-idle (or other non-representative) initial condition. The early output is biased by these initial conditions — this initial biased portion is the transient or warm-up period. If included, it biases the steady-state estimates, so the data collected during the warm-up must be deleted (truncated) before output analysis.
Welch's method: make several replications, compute the ensemble average of the response at each time step across replications, then smooth this averaged process with a moving average of window . Plot the smoothed averages versus time; the warm-up length is taken as the time after which the plot levels off (flattens). Data collected before are discarded.
(c) Terminating vs. Non-terminating simulation (3)
- Terminating simulation: has a natural event that ends the run and a clearly defined start/stop condition; interest is in behaviour over that finite horizon. Example: a bank that opens at 9 am and closes at 5 pm (simulate one day).
- Non-terminating (steady-state) simulation: has no natural ending event; interest is in long-run (steady-state) behaviour. Example: a continuously running manufacturing/assembly line or telephone exchange operating 24×7.
Section B: Short Answer Questions
Attempt all / any as specified.
For an M/M/1 queue with arrival rate λ = 8 customers/hour and service rate μ = 10 customers/hour, compute (i) the server utilization ρ, (ii) the average number of customers in the system L, (iii) the average time a customer spends in the system W, and (iv) the average number waiting in the queue Lq.
For an M/M/1 queue with and :
(i) Utilization: (stable since ).
(ii) Number in system: .
(iii) Time in system: . (Check via Little: ✓.)
(iv) Number waiting in queue: .
Explain any two statistical tests used to test random numbers for uniformity and independence. Briefly describe how the chi-square frequency test and the runs (runs up and down) test are carried out, stating the null hypothesis in each case.
Random numbers must satisfy two properties: uniformity (each value equally likely on ) and independence (no correlation between successive numbers).
Chi-square frequency test (uniformity)
Tests uniformity. Divide into equal sub-intervals (classes). For numbers, the expected count per class is . With observed counts , compute
Null hypothesis : the numbers are uniformly distributed on . Reject if (table value with degrees of freedom at significance level ).
Runs (up-and-down) test (independence)
Tests independence. Scan the sequence and mark a '+' where a number is larger than its predecessor and '−' where it is smaller; a run is a maximal string of like signs. Count the total number of runs . Under independence the expected number and variance are
The standardized statistic is approximately standard normal. Null hypothesis : the numbers are independent. Reject if .
(a) Describe the acceptance-rejection technique for generating random variates and state when it is preferred over the inverse-transform method. (4)
(b) Outline how the convolution method can be used to generate an Erlang variate. (2)
(a) Acceptance–Rejection technique (4)
Used to generate a variate with density when direct inversion is hard. Choose a majorizing function: find a density (easy to sample) and a constant with for all .
Algorithm:
1. Generate Y from g(x).
2. Generate U ~ U(0,1), independent of Y.
3. If U <= f(Y) / (c g(Y)) then ACCEPT: return X = Y.
else REJECT and go to step 1.
The acceptance probability is , so a tight bound (small ) is efficient.
When preferred: when the cdf has no closed-form inverse (so inverse-transform is impractical), e.g. the beta or gamma (non-integer shape) distributions, or when inversion is numerically expensive.
(b) Convolution method for an Erlang variate (2)
An Erlang- variate with rate is the sum of independent exponential variates each with mean . Generate uniforms and form
This is Erlang- (a sum/convolution of exponentials).
Differentiate between continuous simulation and discrete-event simulation, and explain with a labelled diagram the components of a discrete-event simulation model (system state, clock, event list, statistical counters).
Continuous vs. Discrete-event simulation
| Aspect | Continuous simulation | Discrete-event simulation (DES) |
|---|---|---|
| State change | Variables change continuously with time. | State changes only at discrete event instants. |
| Model basis | Differential/difference equations. | Events, entities, queues. |
| Clock | Advances in small fixed steps (numerical integration). | Jumps to next event time. |
| Example | Flow of water in a reservoir; population dynamics. | Customers in a bank queue; machines in a factory. |
Components of a DES model
Described (diagram in words): a central simulation executive/main program repeatedly takes the most imminent event from the event list, advances the clock, calls the corresponding event routine, and updates state and counters.
- System state: the collection of state variables describing the system (e.g. number in queue, server status busy/idle).
- Simulation clock: a variable giving the current value of simulated time.
- Event (future-event) list: a list of future events with their scheduled times of occurrence, ordered by time; the simulation always processes the earliest one next.
- Statistical counters: variables that accumulate performance data (e.g. total waiting time, number served, area under the queue-length curve) for computing output measures.
(Diagram: clock → event list → pick imminent event → update system state → update statistical counters → schedule new events → back to event list.)
(a) What is a confidence interval for the mean response of a simulation, and how is it constructed from the replications of a terminating simulation? (4)
(b) Explain the method of replication for estimating the variance of the sample mean. (2)
(a) Confidence interval for the mean response (4)
A confidence interval (CI) is an interval that contains the true mean response with a stated probability (e.g. 95%); is the half-width measuring the precision of the estimate.
Construction from independent replications: run the terminating simulation times with independent random-number streams, obtaining sample means (one per replication). Then
and the CI is
The are i.i.d. across replications, which justifies the use of the -distribution.
(b) Method of replication for variance of the sample mean (2)
Make independent replications, each giving one summary statistic . Because the are i.i.d., the variance of the overall mean is estimated by
Replications break the autocorrelation present within a single run, giving an unbiased variance estimate.
Describe the steps in a sound simulation study (from problem formulation to documentation and implementation) using a flowchart. Indicate where verification and validation fit in the cycle.
Steps in a sound simulation study (with V&V)
The iterative cycle (Banks/Law) is:
1. Problem formulation
2. Setting of objectives and overall project plan
3. Model conceptualization ┐
4. Data collection ┘ (often done together)
5. Model translation (coding into a program/language)
6. VERIFIED? ── no ──> back to step 5 (coding) [VERIFICATION]
│ yes
v
7. VALIDATED? ── no ──> back to steps 3 & 4 (concept/data) [VALIDATION]
│ yes
v
8. Experimental design
9. Production runs and analysis
10. More runs? ── yes ──> back to step 8
│ no
v
11. Documentation and reporting
12. Implementation
Where V&V fit:
- Verification is the check after model translation (step 5): is the program a correct implementation of the conceptual model? A failure loops back to fixing the code.
- Validation is the next check: does the (verified) model accurately represent the real system? A failure loops back to model conceptualization and data collection (steps 3–4).
Thus the cycle is iterative — the model is repeatedly refined until both verified and validated before production runs are made.
State Little's law and explain the physical meaning of each term. Use it to find the average time in system for a stable queue in which L = 4 customers and the mean arrival rate is λ = 2 customers per minute. List the assumptions under which Little's law holds.
Little's Law
Meaning of terms:
- = the long-run average number of customers in the system.
- = the long-run average arrival (throughput) rate of customers into the system.
- = the long-run average time a customer spends in the system.
In words: the average number in the system equals the arrival rate multiplied by the average time each customer stays. (It applies equally to the queue alone: .)
Numerical: given and customers/min,
Assumptions under which Little's law holds:
- The system is in steady state (stable), so long-run averages exist.
- Customers are conserved — every arrival eventually departs (no creation/loss inside the system).
- The arrival rate equals the departure rate (rate in = rate out over the long run).
It is distribution-free: it needs no assumption about the arrival or service distributions or the queue discipline.
Write short notes on any two of the following:
(a) Generating a discrete empirical (table-lookup) random variate.
(b) Poisson process and its relation to the exponential distribution.
(c) Pseudo-random numbers and the desirable properties of a good random number generator.
(Any two of the following.)
(a) Discrete empirical (table-lookup) random variate
For a discrete random variable taking values with probabilities , build the cumulative distribution . To generate a variate: draw , then find the smallest such that and return . This is the inverse-transform method applied to a step cdf (a table lookup of against the cumulative-probability column).
(b) Poisson process and the exponential distribution
A Poisson process with rate counts random arrivals such that the number of events in an interval of length is Poisson distributed with mean , and counts in disjoint intervals are independent. Its key link: the inter-arrival times are independent exponential random variables with mean . Equivalently, if events occur as a Poisson process, the time between successive events is ; this is the memoryless property and is why exponential service/arrival times generate Poisson counts in queuing models.
(c) Pseudo-random numbers and desirable properties
Pseudo-random numbers are deterministically generated (by an algorithm such as an LCG) yet appear random; being deterministic, they are reproducible. A good generator should be:
- Uniform — values evenly distributed on .
- Independent — no correlation between successive numbers.
- Long period — repeats only after a very large cycle.
- Fast and memory-efficient, and reproducible (same seed → same stream) and portable across machines.
Frequently asked questions
- Where can I find the BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) question paper 2078?
- The full BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) 2078 (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) 2078 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) 2078 paper?
- The BE Computer Engineering (Pokhara University) Simulation and Modeling (PU, CMP 338) 2078 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.