Scripting & Programming Applications
3.0 Credits
Objective Assessment Review (Qns &
Ans)
2025
©2025
, Multiple Choice Questions
Question 1:
In a large-scale web application developed in JavaScript, which approach
most effectively minimizes “callback hell” and improves code readability
when dealing with asynchronous operations?
A. Increasing the number of nested callbacks
B. Using promises with `.then()` chaining
C. Implementing async/await syntax
D. Relying solely on setTimeout for delays
Correct ANS: C. Implementing async/await syntax
Rationale:
Async/await syntax allows asynchronous code to be written in a form
similar to synchronous code. This flattening of the control flow helps
prevent deeply nested callbacks, making the code easier to read and
maintain.
---
Question 2:
A data analytics team is automating routine data ingestion and
transformation tasks using Python. Which technique can most effectively
reduce memory overhead when processing large datasets?
A. Using list comprehensions for all operations
B. Employing generator expressions to yield one item at a time
C. Reading entire files into memory before processing
D. Implementing recursive functions without optimization
Correct ANS: B. Employing generator expressions to yield one item at
a time
Rationale:
©2025
, Generator expressions in Python evaluate items lazily, meaning they
generate one item at a time rather than the entire list at once. This
lowers memory usage significantly, which is especially important in data-
intensive applications.
---
Question 3:
When building a command‑line automation tool in a scripting language,
which advanced feature allows functions to “remember” the
environment in which they were created, thereby maintaining state
between calls?
A. Event loop
B. Closure
C. Recursion
D. Template literals
Correct ANS: B. Closure
Rationale:
Closures capture the local variables of the enclosing scope, enabling a
function to access that state even after the outer function has finished
executing. This feature is invaluable for creating functions with private
state in scripting applications.
---
Question 4:
In a Node.js application that processes filesystem data, which built‑in
module provides essential methods for asynchronous file operations?
A. http
B. os
C. fs
D. path
Correct ANS: C. fs
©2025