Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is the event loop in JavaScript?

View

Which part of JavaScript's runtime pushes asynchronous callbacks to the call stack?

View

What happens when the call stack is empty in JavaScript?

View

What is the purpose of setTimeout() in relation to the event loop?

View

What does the term "non-blocking" mean in JavaScript?

View

What is the difference between the call stack and the task queue in JavaScript?

View

What does setImmediate() do in Node.js?

View

How does process.nextTick() work in Node.js?

View

What is the microtask queue in the JavaScript event loop?

View

In what order does the event loop handle tasks?

View

What is the event loop in JavaScript?

A loop that continuously checks the message queue and pushes tasks to the call stack.
A function that executes at regular intervals.
A way to perform synchronous operations.
A loop that resolves promises.

Which part of JavaScript's runtime pushes asynchronous callbacks to the call stack?

Event loop.
Call stack.
Task queue (or message queue).
Execution context.

What happens when the call stack is empty in JavaScript?

The event loop checks the task queue for pending callbacks or promises to push to the call stack.
The program crashes.
The event loop stops.
New tasks are ignored until the call stack is refilled.

What is the purpose of setTimeout() in relation to the event loop?

It schedules a function to run after the call stack is clear and the delay has passed.
It pauses the event loop for a specific time.
It immediately executes the callback function.
It halts the call stack until the timeout is over.

What does the term "non-blocking" mean in JavaScript?

Code execution is not halted by asynchronous operations.
Only synchronous code is allowed.
The event loop can block operations temporarily.
Functions run in parallel.

What is the difference between the call stack and the task queue in JavaScript?

The call stack handles the current execution, while the task queue stores asynchronous callbacks.
The call stack only handles event listeners.
The task queue handles synchronous functions.
There is no difference; they perform the same function.

What does setImmediate() do in Node.js?

It executes a function immediately after the current event loop iteration
It runs a function synchronously
It adds a function to the call stack
It delays a function by a set number of milliseconds

How does process.nextTick() work in Node.js?

It schedules a callback to be executed at the beginning of the next event loop cycle.
It runs code after all other code has executed
It delays code execution.
It pushes tasks to the call stack.

What is the microtask queue in the JavaScript event loop?

A queue that contains promises and other high-priority tasks to be executed before the task queue.
A queue for long-running synchronous tasks.
A queue for user interaction events.
A queue for setTimeout() callbacks.

In what order does the event loop handle tasks?

The call stack is cleared first, followed by microtasks (promises), and then tasks from the task queue.
Microtasks are handled after each task queue operation.
Tasks are handled before promises.
Tasks and promises are handled concurrently.