Script Valley
Node.js: The Complete Runtime
The Node.js Runtime Explained/Assessment

Practice & Assessment

Test your understanding of The Node.js Runtime Explained

Multiple Choice Questions

5
1

What is the correct execution order? setTimeout(() => console.log('A'), 0); Promise.resolve().then(() => console.log('B')); process.nextTick(() => console.log('C')); console.log('D');

2

Which package.json version range allows ONLY patch updates to express 4.18.2?

3

In a Node.js ES Module (.mjs), how do you get the equivalent of __dirname?

4

Why can flooding process.nextTick recursively starve I/O callbacks?

5

What does setting "type": "module" in package.json do?

Coding Challenges

1
1

Event Loop Order Predictor

Write a Node.js script that uses setTimeout (0ms), setImmediate, Promise.resolve().then(), and process.nextTick to print letters A through D in the order: D (sync), C (nextTick), B (Promise), A (setImmediate). Then add a comment block explaining why each fires in that sequence. Input: none. Output: four console.log lines in the correct order with a comment explanation. Estimated time: 15 minutes.

Easy

Mini Project

1

Node.js Runtime Info CLI

Build a CLI tool (single file, no external dependencies) that accepts a --info flag and prints a formatted report including: Node.js version, platform, process uptime, memory usage (heapUsed in MB), the current working directory, and all environment variables whose key starts with NODE_. Use process, __dirname, and path.join. The output must be human-readable plain text. Run it with: node info.js --info. If --info is not passed, print usage instructions.

Easy