Q1. What is the Node.js event loop and how does it work?
The event loop is the mechanism that allows Node.js to perform non-blocking I/O operations despite JavaScript being single-threaded. It continuously checks the call stack and the callback queue. When the call stack is empty it picks callbacks from the queue and executes them. Internally it has phases: timers (setTimeout/setInterval), pending callbacks, idle/prepare, poll (I/O), check (setImmediate), and close callbacks. Understanding this prevents blocking the loop with CPU-heavy synchronous code.