LinkedIn Node JS Skill Assessment Answers (2024)

The LinkedIn Skill Assessments feature allows you to demonstrate your knowledge of the skills you’ve added on your profile. Job posters on LinkedIn can also add Skill Assessments as part of the job application process. This allows job posters to more efficiently and accurately verify the crucial skills a candidate should have for a role.

LinkedIn Node JS Skill Assessment Answers
LinkedIn Node JS Skill Assessment Answers

The topics in the Node.js assessment include:

  • Modules
  • Packages
  • Events
  • HTTP
  • Console
  • Utilities
  • Node.js Fundamentals
  • Streams

Question Format
Multiple Choice

Language
English

Table of Content


LinkedIn Node JS Skill Assessment Answers

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

  • the call stack
  • the event loop
  • the poll phase
  • the events queue

Which of the following is a core module in Node?

  • webpack
  • crypto
  • request
  • chalk

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

  • allocUnsafe
  • concat
  • from
  • alloc

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

  • ftp
  • events
  • dgram
  • http2

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

  • read
  • readFile
  • createReadStream
  • readFileSync

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

  • lookup
  • resolve
  • resolve4
  • reverse

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

  • util.types.isDate(value)
  • assert.isDate(value)
  • console.isDate(value)
  • util.date(value)

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

  • no, there are no modules supporting it yet
  • yes, with the https or http2 modules
  • yes, through the path module
  • yes, with the http module

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

  • A-API
  • Z-API
  • N-API
  • X-API

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

  • –dev-tools
  • –inspect
  • –chrome
  • –debug

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

  • node -p “process.cpus”
  • node -p “util.cpus().size”
  • node -p “process.os.cpus”
  • node -p “os.cpus().length”

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

  • exit
  • test
  • time
  • print

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

  • global.cache
  • module.cache
  • process.cache
  • require.cache

What is the command to silence all process warnings?

  • node index.js –trace-warnings
  • node –no-warnings
  • node -trace-warnings
  • node index.js –no-warnings

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

  • new Promise(child_process.exec())
  • util.promisify(child_process.exec())
  • util.promisify(child_process.exec)
  • new Promise(child_process.exec)

Which of the following is NOT a Node repl command?

  • .break
  • .history
  • .editor
  • .save

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

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.
  • The forked process shares the same VM thread with the parent process.

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

  • EventEmitter.emit(‘change’);
  • EventEmitter.new().emit(‘change’);
  • (new EventEmitter()).emit(‘change’);
  • new EventEmitter(‘change’);

Which of the following objects is a stream

  • process.uptime
  • process.stdout
  • process
  • Buffer

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

  • __pathname
  • __location
  • __flder
  • __filename

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

  • spawn(“ps -ef”)
  • exec(“ps -ef”)
  • exec(“ps”, “-ef”)
  • fork(“ps -ef”)

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

  • stack
  • trace
  • debug
  • print

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

  • the libuv library
  • the c-ares library
  • the VM (like VS or Chakra)
  • the repl module

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}/`); });

  • 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/

What is the purpose of the path module?

  • to provide utilities to play with file and directory paths
  • to provide utilities to add and remove files
  • It is a retiring module.
  • to provide utilities to test files

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

  • server. start
  • server.activate
  • server.listen
  • server. run

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!’);}
);

  • creates a text file hello.txt and appends customized text
  • creates an image file
  • console logs system information
  • creates a file named data and append numbers

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

  • nodemon start
  • start index.js
  • node index.js
  • node start

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

  • to provide methods to work with requests and responses
  • to provide methods to work with files
  • to provide methods to work with databases
  • to find new file systems

What is the Node LTS version?

  • 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.

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

  • process. stdinfo
  • process. stdin
  • process. stdout
  • process. stder

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);

  • ReferenceError: arguments is not defined
  • an empty string
  • undefined
  • an object representing an array that has five elements

Which choice is not a valid method on event emitters?

  • start
  • on
  • once
  • off

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

  • process
  • Buffer
  • root
  • require

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?

  • node index.js -x
  • node -v
  • node -h
  • node index.js -h

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?

  • http.IncomingMessage
  • http.ServerRequest
  • http.ClientRequest
  • http.ServerResponse

What are the arguments passed to the module wrapper function?

  • exports, __filename, __dirname
  • exports, process, require, module, __filename, __dirname
  • exports, module, __filename, __dirname
  • exports, require, module, __filename, __dirname

Which library provides Node.js with the event loop?

  • V8
  • c-ares
  • libuv
  • events

What does the .node file extension represent?

  • a C++ file that can have a .node extension and that Node will be able to execute directly.
  • a C++ Addon file that is built with node-gyp
  • a JSON file that can have a .node extension as well as the .json extension
  • a JavaScript file that can have a .node extension as well as the .js extension

What can you export with module.exports?

  • only objects.
  • only functions
  • only variables and arrays
  • functions, objects, arrays, or anything you assign to the module

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

  • os
  • util
  • cluster
  • net

Which core Node module has wrappers for OpenSSL methods?

  • SSL
  • hash
  • crypto
  • TLS

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

  • const { readFile } = require(fs).promises
  • const { readFile } = require(fs)
  • const { readFilePromises: readFile } = require(fs)
  • const { readFile } = require(promises)

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?

  • Changes are not backwards compatible.
  • Changes might not be backward compatible and might break existing code.
  • Changes are just bug fixes and no new features were added.
  • Changes will add new functionality but will not break any existing code.

What does REPL stand for?

  • run, examine, put, loop
  • read, eval, print, loop
  • run, edit, print, loop
  • read, extend, print, loop

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

  • .gyprc
  • binding.gyp
  • gyp.json
  • package.gyp

Which core module in Node can you use for testing?

  • chai
  • jest
  • assert
  • mocha

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

  • cluster
  • async_hooks
  • dgram
  • inspector

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

  • buffer
  • util
  • string_decoder
  • string_buffer

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

  • v8
  • env
  • process
  • child_process

Which statement is true about Node.js and threads?

  • Every Node process runs in a single thread, and all the I/O work is run in that same thread.
  • Every Node process gets four threads that it can share between its JavaScript VM and the event loop.
  • The event loop is single-threaded, but a JavaScript VM can use multiple threads.
  • JavaScript execution in Node.js is single-threaded, but I/O operations are executed using multiple threads.

Which statement about event emitters is false?

  • Event names must be camelCase strings.
  • The emit method allows a arbitrary set of arguments to be passed to the listener functions.
  • Any values returned by the listeners for an emitted events are ignored.
  • When an event emitter objeect emits an event, all of the functions attached to that specific event are called synchronously.

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

  • sandbox
  • buffer
  • vm
  • v8

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

  • const numInstances = cluster.instances().length;
  • const numInstances = cluster.instances();
  • const numInstances = require(‘os’).cpus().length;
  • const numInstances = process.cpus().length;

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?

  • Use regular expressions directly on the file.
  • Use Promises and async/await to offload the task to libuv.
  • Copy the file into a database and perform the operations there.
  • Use readline together with streams to read and transform and write the file contents line by line.
  • E-commerce platforms

Which choice is not a Node global object?

  • process
  • exports
  • setTimeout
  • Buffer

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

  • readableStream.pipe(writableStream)
  • readableStream.on(pipe, writableStream)
  • writableStream.pipe(readableStream)
  • writableStream.on(pipe, readableStream)

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

  • path.concat
  • path.join
  • path.format
  • path.parse

What is the purpose of N-API?

  • to allow users to make requests to the server
  • to insulate Addons from changes in the underlying JavaScript engine
  • to execute multi-threaded code in the Node environment
  • to provide a quick way for users to create REST APIs

What is a process object and its role?

  • a locally scoped object that provides information about the current node process
  • a global object that provides information about files
  • a global object that provides information about the database
  • a global object that provides information about the current node process

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);

  • {‘Jane’}
  • { name: ‘Jane’ }
  • {}
  • Jane

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’}
  • {}

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

  • yes, through the assert module
  • yes, through the debugger module
  • yes, through the console module
  • no

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

  • fail
  • doesNotThrow
  • deepStrictEqual
  • ifError

Which choice is not a method on the util module?

  • promisify
  • asyncify
  • types
  • callbackify

Which choice is not a subclass of the Error class?

  • GlobalError
  • TypeError
  • RangeError
  • AssertionError

What is Node built on?

  • Python
  • V8 JavaScript engine
  • PHP
  • c

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 asynchronous, this is handled by a libuv and a threadpool. The performance will not notably degrade.
  • As the application code runs asynchronously within a single thread, the execution will block, accepting no more requests until the operation is completed.
  • As Node.js is asynchronous, 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.

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

  • EventLoop
  • Libuv
  • Google V8
  • Express.js

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

  • It indicates success or failure to the client and helps with testing.
  • It is not important to have good practices regarding status codes
  • Response codes are the only way you can tell what is happening on the server.
  • It contains information about the current performance of the server.

How can ECMAScript modules be used natively in Node?

  • ECMAScript modules cannot be used natively in Node.
  • ECMAScript modules can be used natively in Node with the .mjs file extension
  • ECMAScript modules can be used natively in Node only by using a compiler like Babel.
  • ECMAScript modules can be used natively in Node only by using a bundle like webpack.

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

  • They are an indication of the stability of Nodejs modules and usage recommendations.
  • They tell if a feature is ES6 compliant.
  • They are a Node command to validate stability of your code.
  • They tell if a feature is LTS (Long Term Supported).

Which choice is a core module in Node?

  • crypto
  • chalk
  • webpack
  • request

Which DNS module method uses the underlying OS facilities and does not necessarily perform any network communication?

  • resolve
  • reverse
  • lookup
  • resolve4

What is one way to check that a value is a date object in Node?

  • console.isDate(value)
  • util.date(value)
  • assert.isDate(value)
  • util.types.isDate(value)

When you require(something), where will Node.js attempt to resolve(something)?

  • the local .modules folder, then the parents’ node_modules folder
  • the local node_modules folder, then the parents’ node_modules folder
  • the .modules folder under the home directory
  • a “something.js” file or a “something” folder, which exist on the same level as the requiring file

An external library has its own codebase and license. It is not managed by the Node.js core team. Which choice is an external library that Node.js uses?

  • net
  • openssl
  • cluster
  • events

What is the main purpose of the package-lock.json file?

  • to be a system file
  • to provide an exact, single representation of the dependency tree
  • to serve as a module to export dependencies
  • to be a log for the application

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

  • const numInstances = process.cpus().length
  • const numInstances = cluster.instances().length
  • const numInstances = cluster.instances()
  • const numInstances = require(‘os’).cpus().length

What response will you get when you send a get requests to the server with this code?

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}/`);
});

  • server running at http://127.0.0.1:3000
  • server running at port 3000
  • server running at http://localhost:3000/
  • server running at http://localhost:4000/

All Linkedin Skill Assessment Answers


List of Technical Skill Assessment


List of Business Skill Assessment


List of Design Skill Assessment


Leave a Reply