Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active March 4, 2022 17:14
Show Gist options
  • Save wilmoore/88e17d9270933ca79518a130b7bbbc56 to your computer and use it in GitHub Desktop.
Save wilmoore/88e17d9270933ca79518a130b7bbbc56 to your computer and use it in GitHub Desktop.
Income Sources :: Technical Assessments :: Node.js :: LinkedIn

Income Sources :: Technical Assessments :: Node.js :: LinkedIn

⪼ Made with 💜 by realpolyglot.dev

Topics: Console, Events, HTTP, Modules, Packages

  • 15 multiple choice questions
  • 1.5 minutes per question
  • Score in the top 30% to earn a badge

Practic Assessment

Which core module in Node can you use for testing?
  • mocha
  • chai
  • jest
  • assert
What will this code log to the console?
// File: person.js
exports = "John";

// File: index.js
const person = require('./person.js');
console.log(person);
  • {'john'}
  • Undefined
  • {}
  • John

Assessment

Which object is a stream?
  • process
  • process.stdout
  • Buffer
  • process.uptime
Which assert module method is usually used to test the error-first argument in callbacks?
  • deepStrictEqual
  • ifError
  • doesNotThrow
  • fail
What is the purpose of N-API?
  • to provide a quick way for users to create REST APIs
  • to insulate Addons from changes in the underlying JavaScript engine
  • to execute multi-threaded code in the Node environment
  • ...
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);
  • undefined
  • an empty string
  • ReferenceError: arguments is not defined
  • an object representing an array that has five elements
Which library provides Node.js with the event loop?
  • c-ares
  • V8
  • events
  • libuv
Which choice is not a method on the util module?
  • types
  • promisify
  • asyncify
  • callbackify
How can you use the Promise API with a callback-based function such as child_process.exec?
  • util.promisify(child_process.exec())
  • new Promise(child_process.exec)
  • util.promisify(child_process.exec)
  • new Promise(child_process.exec())
Which statement about event emitters is false?
  • Event names must be camelCase strings.
  • Any values returned by the listeners for an emitted event are ignored.
  • The emit method allows an arbitrary set of arguments to be passed to the listener functions.
  • When an event emitter object emits and event, all of the functions attached to that specific event are called syncronously.
When a request event is recieved in the HTTP module, what is the type of the first argument passed to that event, usually named req?
  • http.IncomingMessage
  • http.ServerRequest
  • http.ServerResponse
  • http.ClientRequest
Which core module in Node can you use to compile and run JavaScript code in a sandbox environment?
  • vm
  • sandbox
  • v8
  • buffer
Which file does node-gyp use to read the build configuration of a module?
  • binding.gyp
  • package.gyp
  • gyp.json
  • .gyprc
Which special object is an instance of EventEmitter
  • process
  • root
  • Buffer
  • require
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?
  • As Node.js is asyncronous, this is handled by a libuv and a threadpool. The performance will not notably degrade.
  • As the application code runs asyncronously within a single thread, the execution will block, accepting no more requests until the operation is completed.
  • As Node.js is asyncronous, this is handled by a threadpool and the performance will not notably degrade.
  • The current thread will block until the execution is completed and the operating system will spawn new threads to handle incoming requests. This can exhaust the number of allowed threads (255) and degrade performance over time.
How would you determine the number of cluster instances to start when using the cluster module?
  • const numInstances = cluster.instances();
  • const numInstances = cluster.instances().length;
  • const numInstances = process.cpus().length;
  • const numInstances = require('os').cpus().length;
Which of the followign Buffer class methods returns an uninitialized buffer?
  • concat
  • allocUnsafe
  • from
  • alloc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment