Recall & Review
beginner
What does 'single-threaded' mean in Node.js?
It means Node.js runs JavaScript code on one main thread, handling tasks one at a time in a sequence.
Click to reveal answer
beginner
Explain 'non-blocking I/O' in simple terms.
Non-blocking I/O lets Node.js start a task like reading a file, then keep doing other work without waiting for the task to finish.
Click to reveal answer
intermediate
How does Node.js handle multiple I/O operations with a single thread?
Node.js uses an event loop to watch for completed tasks and callbacks to handle results, so it can manage many I/O tasks without waiting.
Click to reveal answer
beginner
Why is single-threaded non-blocking I/O good for web servers?
Because it can handle many users at once without waiting, making servers fast and efficient even with many requests.
Click to reveal answer
intermediate
What happens if a task blocks the single thread in Node.js?
The whole program waits and becomes slow, because no other tasks can run until the blocking task finishes.
Click to reveal answer
What does 'non-blocking' mean in Node.js I/O?
✗ Incorrect
Non-blocking means Node.js starts a task and continues running other code without waiting for the task to finish.
How many main threads does Node.js use to run JavaScript code?
✗ Incorrect
Node.js runs JavaScript on a single main thread.
What mechanism does Node.js use to manage I/O tasks without blocking?
✗ Incorrect
The event loop watches for completed tasks and triggers callbacks to handle them.
Why can blocking code slow down a Node.js application?
✗ Incorrect
Blocking code stops the single thread, so no other code can run until it finishes.
Which of these is a benefit of Node.js single-threaded non-blocking I/O?
✗ Incorrect
Node.js can handle many requests at once without waiting, making it efficient.
Describe how Node.js uses single-threaded non-blocking I/O to handle multiple tasks.
Think about how Node.js can do many things without waiting for each to finish.
You got /4 concepts.
Explain why blocking code is a problem in Node.js and how non-blocking I/O solves it.
Consider what happens when the main thread is busy or free.
You got /4 concepts.