Python Data Science Jobs & Interviews
20.6K subscribers
192 photos
4 videos
25 files
334 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
Advanced Real-World Simulation Problem Solving Test

1. Write a Python program to simulate the diffusion process of particles in a 2D grid over time.

2. What will be the output of this code simulating a simple queue model?
def process_queue(events):
    queue = []
    for e in events:
        if e == 'arrive':
            queue.append(1)
        elif e == 'serve' and queue:
            queue.pop(0)
    return len(queue)

print(process_queue(['arrive', 'arrive', 'serve', 'arrive', 'serve', 'serve']))


3. Which numerical method is most appropriate for solving the motion equations of a pendulum with friction?

a) Euler’s Method
b) Runge-Kutta Method
c) Monte Carlo Method
d) Finite Element Method

4. Describe how Monte Carlo simulations can be used to estimate the value of pi.

5. Given the output below, what kind of simulation does this represent and what is being measured?
Temperature: 300 K, Pressure: 1 atm, Particles: 5000
Average Velocity: 500 m/s


6. Implement a cellular automaton simulator for Conway’s Game of Life, taking initial states as input.

7. Explain the difference between discrete-event simulation and continuous simulation.

8. What is the output of this simulation of random walk?
import random
position = 0
for _ in range(3):
    step = random.choice([-1, 1])
    position += step
print(position)


9. Write a function simulating an M/M/1 queue and calculating the average wait time for a given arrival and service rate.

10. What are the limitations of agent-based simulations in modeling complex systems?

11. How does time step selection affect the accuracy and performance of a numerical simulation?

12. Given a system modeled by differential equations, write Python code using scipy.integrate.odeint to solve it.

13. Which data structure is most suited to efficiently manage a priority queue of events in a discrete-event simulation?

a) list
b) heap
c) dictionary
d) set

14. What will this code print that simulates a simple predator-prey model?
def model(rabbits, foxes):
    rabbits += 5 - 0.1 * rabbits * foxes
    foxes += 0.05 * rabbits * foxes - 2
    return int(rabbits), int(foxes)
r, f = 30, 5
for _ in range(3):
    r, f = model(r, f)
print(r, f)


15. Describe how hybrid simulation combines discrete-event and continuous models.

16. Write code to simulate a traffic light control system with three states (Green, Yellow, Red) and timed transitions.

17. What challenges are involved in verifying and validating simulation models?

18. What output do you expect from the following Gillespie algorithm step?
import numpy as np
reactions = [0.3, 0.7]
r = np.random.random()
cum_prop = np.cumsum(reactions)
print(np.searchsorted(cum_prop, r))


19. How can parallel processing improve the performance of large-scale simulations?

20. Write a Python program to simulate radioactive decay for a given number of atoms and decay probability per step.

#Simulation #Modeling #NumericalMethods #RealWorldProblems #AdvancedProgramming

By: @DataScienceQ ⭐️
Please open Telegram to view this post
VIEW IN TELEGRAM
2