Programming for Engineers
Final Exam Review
(Questions & Solutions)
2025
1
, Section I – Multiple Choice (8 Questions)
Question 1:
In object‑oriented programming for engineering simulations, which
feature best enables modular code reuse and simplifies the management
of large software systems?
A. Recursion
B. Inheritance
C. Exception handling
D. File I/O operations
ANS: B
Rationale: Inheritance allows new classes (derived classes) to reuse,
extend, or modify the attributes and behaviors of existing classes (base
classes). This feature is especially important in designing modular and
scalable simulation software for engineering applications.
---
Question 2:
Which Python library is most widely employed for efficient numerical
computations and large‑scale array manipulation in engineering
applications?
A. Matplotlib
B. NumPy
C. Requests
D. Flask
ANS: B
Rationale: NumPy is the foundational library for numerical
computations in Python. Its support for N‑dimensional arrays and
vectorized operations makes it indispensable for engineering tasks
2
, involving large datasets and matrix computations.
---
Question 3:
When designing an embedded system simulation, which design pattern is
particularly useful for decoupling modules where one module must be
automatically notified of changes in another?
A. Singleton
B. Observer
C. Factory
D. Decorator
ANS: B
Rationale: The Observer pattern allows one object (the subject) to
notify multiple dependent objects (observers) of any state change,
facilitating decoupled designs that are easier to maintain and extend in
simulation and control systems.
---
Question 4:
In a multithreaded engineering simulation, which technique is essential
to ensure that concurrently running threads do not update shared
resources simultaneously, thereby avoiding race conditions?
A. Recursion
B. Dynamic typing
C. Locking mechanisms (mutexes)
D. Lazy evaluation
ANS: C
Rationale: Locking mechanisms, such as mutexes, semaphores, or
critical sections, are used to synchronize access to shared resources
among concurrent threads, preventing race conditions and ensuring data
integrity.
3