- the call stack <<<<-----Correct - the event loop - the poll phase - the events queue
- webpack - crypto <<<<-----Correct - request - chalk
- allocUnsafe <<<<-----Correct - concat - from - alloc
- ftp <<<<-----Correct - events - dgram - http2
- read - readFile - createReadStream <<<<----Correct From official docs: [https://nodejs.org/api/fs.html#fs_dir_read](https://nodejs.org/api/fs.html#fs_dir_read) To minimize memory costs, when possible prefer streaming via fs.createReadStream(). - readFileSync
- lookup <<<<----Correct - resolve - resolve4 - reverse
- util.types.isDate(value) <<<<----Correct - assert.isDate(value) - console.isDate(value) - util.date(value)
- no, there are no modules supporting it yet - yes, with the https or http2 modules <<<<----Correct - yes, through the path module - yes, with the http module
- A-API - Z-API - N-API <<<<----Correct - X-API
- --dev-tools - --inspect <<<<----Correct - --chrome - --debug
- node -p "process.cpus" - node -p "util.cpus().size" - node -p "process.os.cpus" - node -p "os.cpus().length" <<<<----Correct
- exit - test - time <<<<----Correct - print
- global.cache - module.cache - process.cache - require.cache <<<<----Correct
- node index.js --trace-warnings - node --no-warnings <<<<----Correct - node -trace-warnings - node index.js --no-warnings
- new Promise(child_process.exec()) - util.promisify(child_process.exec()) - util.promisify(child_process.exec) <<<<----Correct - new Promise(child_process.exec)
- .brake - .history <<<<----Correct - .editor - .save
```js require('child_process').fork('script.js'); ``` - The forked process shares the event loop with the parent process - A new VM instance is created and the two VM instances will be shared between the forked process and the parent process. - The forked process will have its own VM instance. <<<<----May be - The forked process shares the same VM thread with the parent process.
- EventEmitter.emit(change); <<<<----Correct //Because the EventEmitter is already in scope. No need to create new one. - EventEmitter.new().emit(change); - (new EventEmitter()).emit(change); - new EventEmitter(change);
- process.uptime - process.stdout <<<<-----Correct // Buffer is Buffer type. - process - Buffer
- __pathname - __location - __flder - __filename <<<<----Correct
- spawn("ps -ef") - exec("ps -ef") <<<<-----Correct - exec("ps", "-ef") - fork("ps -ef")
- stack - trace ---> correct - debug - print
- the libuv library - the c-ares library - the VM (like VS or Chakra)-----> correct - the repl module
const hostname = '127.0.0.1'; const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200; res.setHeader("Content-Type", "text/plain"); res.end("Hello World\n");
});
server.listen(port, hostname, () => { console.log(`server running at http://${hostname}:${port}/`); });
- server running at http://localhost:3000/ - server running at port 3000 - server running at http://localhost:4000/ - server running at http://127.0.0.1:3000/ -----> correct
- to provide utilities to play with file and directory paths -----> correct - to provide utilities to add and remove files - It is a retiring module. - to provide utilities to test files
- server. start - server.activate - server.listen -----> correct - server. run
const fs = require('fs'); const os o require('os');
const system = os.platform(); const user = os.userInfo().username;
fs.appendFilechello.txt'l 'Hello ${user} on ${system}r, (err) => { if (err) throw err; console.log('The data was appended to file!');
) ;
- creates a text file hello.txt and appends customized text -----> correct - creates an image file - console logs system information - creates a file named data and append numbers
- nodemon start - start index.js - node index.js -----> correct - node start
- to provide methods to work with requests and responses - to provide methods to work with files -----> correct - to provide methods to work with databases - to find new file systems
- It is the current unstable version and is to be avoided. - It is the version that will be retired soon. - It is the version with the latest features. - It is the safest version for long-term support. -----> correct
- process. stdinfo -----> correct - process. stdin - process. stdout - process. stderr
console.log(arguments);
- ReferenceError: arguments is not defined - an empty string - undefined - an object representing an array that has five elements -----> correct