Recall & Review
beginner
What is the purpose of the Node.js 'os' module?
The 'os' module provides methods to get information about the operating system, like CPU details, memory, and network interfaces.
Click to reveal answer
beginner
How do you get the total amount of system memory using the 'os' module?
Use os.totalmem() to get the total system memory in bytes.
Click to reveal answer
beginner
Which method returns the operating system's default directory for temporary files?
os.tmpdir() returns the path to the default temporary files directory.
Click to reveal answer
intermediate
What does os.cpus() return?
It returns an array of objects, each describing a CPU/core's model, speed, and times spent in different modes.
Click to reveal answer
beginner
How can you find the current user's home directory using the 'os' module?
Use os.homedir() to get the path of the current user's home directory.
Click to reveal answer
Which method from the 'os' module gives you the system uptime in seconds?
✗ Incorrect
os.uptime() returns the system uptime in seconds.
What type of value does os.freemem() return?
✗ Incorrect
os.freemem() returns the amount of free system memory in bytes.
Which method provides network interface details?
✗ Incorrect
os.networkInterfaces() returns an object describing the network interfaces.
How do you get the operating system platform (like 'linux' or 'win32')?
✗ Incorrect
os.platform() returns the operating system platform.
What does os.endianness() return?
✗ Incorrect
os.endianness() returns the CPU byte order: 'BE' for big-endian or 'LE' for little-endian.
Explain how you would use the 'os' module to find out the total and free memory on a system.
Think about methods that return memory info in bytes.
You got /3 concepts.
Describe how to get CPU information and network interfaces using the 'os' module.
Look for methods that return arrays or objects with system hardware info.
You got /3 concepts.