linkedin-skill-assessments-quizzes

Node.js

Q1. When a javaScript function is invoked (called) in Node, where is a new frame placed?

Explanation: From javascripttutorial: reference

Q2. Which of the following is a core module in Node?

Explanation: From flaviocopes docs: reference

Q3. Which of the following Buffer class methods returns an uninitialized buffer?

Explanation: From official docs: reference

Q4. Which of the following modules is NOT a built-in module in Node?

Explanation: From flaviocopes docs: reference

Q5. Which fs module method can be used to read the content of a file without buffering it in memory?

Explanation: From official docs: reference To minimize memory costs, when possible prefer streaming via fs.createReadStream().

Q6. Which of the following DNS module methods uses the underlying OS facilities and does not necessarily perform any network communication?

Explanation: From official docs: reference

Q7. How do you check that a value is a date object in Node?

Explanation: From official docs: reference

Q8. Can you create an https web server with Node.js?

Explanation: From official docs: reference

Q9. What is the Api that is designed to insulate Addons from changes in the underlying JavaScript engine?

Explanation: From official docs: reference

Q10. Which CLI option can you use to debug a node script in Chrome DevTools?

Explanation: From official docs: reference

Q11. How can you count the number of logical CPUs on the machine that is running Node?

Explanation: From coderrocketfuel docs: reference

Q12. Which of the following is a method on the console object?

Explanation: From official docs: reference

Q13. Which object is used to manage the cache of required modules?

Explanation: From official docs: reference

Q14. What is the command to silence all process warnings?

Explanation: From official docs: reference

Q15. How can you use the promise API with a callback-based function such as child_process.exec?

Explanation: From official docs: reference

Q16. Which of the following is NOT a Node repl command?

Explanation: From official docs: reference

Q17. Which statement is true when you run the code shown below?

require('child_process').fork('script.js');

Explanation: From official docs: reference

Q18. If EventEmitter is in scope, which of the following lines of code will have an event emitter emitting a change event?

Explanation: Because the EventEmitter is already in scope. No need to create new one.

Q19. Which of the following objects is a stream

Explanation: process.stdout is Buffer type.

Q20. Which module variable holds the resolved absolute path of the current module file?

Q21. If the child_process module methods are in scope, what is a current way to execute the command ps -ef using a child process?

Q22. Which console method can be used to print the stack trace to the point of its execution?

Q23. When you run JavaScript in a Node.js application, which of the following elements in a Node.js stack actually executes that JavaScript?

Q24. Looking at the code below, what does the console show?

const http = require('http');
 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}/`); });

Q25. What is the purpose of the path module?

Q26. How do you make an HTTP server object active and listen to requests on certain ports?

Q27. What does the code shown below do?

const fs = require('fs'); const os = require('os');
const system = os.platform(); const user = os.userInfo().username;
fs.appendFile('hello.txt', `Hello ${user} on ${system}`, (err) => { if (err) throw err; console.log('The data was appended to file!');}
);

Q28. How do you start a Node application, if the entry file is indexjs?

Q29. What is the purpose of the file system (fs) module?

Q30. What is the Node LTS version?

Q31. Which of the following is NOT a valid stream in Node?

Q32. You have a script.js file with the single line of code shown here. What will be the output of executing script.js with the node command?

console.log(arguments);

Q33. Which choice is not a valid method on event emitters?

Q34. Which special object is an instance of EventEmitter?Which special object is an instance of null?

Q35. What is the command to get a list of available commands for Node.js?What is the command to get a list of available commands for Node.js?

Q36. When a request event is received in the HTTP module, what is the type of the first argument passed to that event, usually named req?

Q37. What are the arguments passed to the module wrapper function?

Q38. Which library provides Node.js with the event loop?

Q39. What does the .node file extension represent?

Q40. What can you export with module.exports?

Q41. Which core module in Node can you use to take advantage of multicore systems?

Q42. Which core Node module has wrappers for OpenSSL methods?

Q43. Which line imports a promise-based version of the readFile method?

Q44. According to the rules of semantic versioning, what does a release incrementing the third number in an npm version string communicate to users about the release changes?

Q45. What does REPL stand for?

Q46. Which file does node-gyp use to read the build configuration of a module?

Q47. Which core module in Node can you use for testing?

Q48. Which core module in Node provides an API to register callbacks to track asynchronous resources created inside a Node.js application?

Q49. Which Node.js module should you use when you need to decode raw data into strings?

Q50. Which global object acts like a bridge between a Node script and the host operating system?

Explanation: _process is an global object and act like a bridge, the others aren’t

  1. source
  2. source

Q51. Which statement is true about Node.js and threads?

Explanation: https://www.geeksforgeeks.org/why-node-js-is-a-single-threaded-language/

Q52. Which statement about event emitters is false?

Q53. Which core module in Node can you use to compile and run JavaScript code in a sandbox environment?

Q54. How would you determine the number of cluster instances to start when using the cluster module?

Explanation: From official docs: https://nodejs.org/api/cluster.html#cluster_cluster

Q55. You have to read a large text file, replace some words in it, and write it back to a new file. You know that the memory on your target system is limited. What should you do?

Explanation: From official docs: https://nodejs.org/api/readline.html#readline_example_read_file_stream_line_by_line

Q56. Which choice is not a Node global object?

Explanation: process, exports and setTimeout are global objects, Buffer isn’t (please see https://nodejs.org/api/globals.html)

Q57. What is the correct way to pipe a readable stream and a writable stream?

Q58. How can you convert path segments into a string using the platform-specific separator as a delimiter?

Q59. What is the purpose of N-API?

Q60. What is a process object and its role?

Q61. What will this code log to the console?

// File: person.js
exports.name = "Jane";

// File: index.js
const person = require('./person.js');
console.log(person);

Q62. What will this code log to the console?

// File: person.js
exports = "John";

// File: index.js
const person = require('./person.js');
console.log(person);

Q63. Is it possible to write tests in Node.js without an external library?

From the article: Making a Testing Framework in Node.js (Without any External Libraries)

Q64. Which assert module method is usually used to test the error-first argument in callbacks?

Q65. Which choice is not a method on the util module?

Q66. Which choice is not a subclass of the Error class?

Q67. What is Node built on?

Q68. How does it affect the performance of a web application when an execution path contains a CPU-heavy operation, such as calculating a long Fibonacci sequence?

Q69. What is used for parsing and running Javascript in Node.js?

Q70. What is the importance of having good practices around status code in your response?

Q71. How can ECMAScript modules be used natively in Node?

Q72. When exploring the Node documentation’s features, what are the stability ratings?

Q73. Which of the following DNS module methods uses the underlying OS facilities and does not necessarily perform any network communication?

Q74. Which coice is a core module in Node?

Reference