When importing a module, what is the difference between a relative and absolute path?

  • A relative path specifies the module's location relative to the current file, while an absolute path specifies the module's exact location in the file system.
  • A relative path always begins with a forward slash (/), while an absolute path does not use any slashes.
  • A relative path is used for built-in Node.js modules, while an absolute path is used for third-party modules.
  • A relative path is used for server-side modules, while an absolute path is used for client-side modules.
In Node.js, when importing a module, you can use either a relative path or an absolute path. A relative path specifies the module's location relative to the current file, making it flexible for local module imports. An absolute path, on the other hand, specifies the exact file system path to the module.

What is the significance of the engines field in the package.json file of a Node.js project?

  • It lists the development tools used for the project.
  • It specifies the JavaScript engines that can run the project.
  • It defines the project's build scripts.
  • It lists the project's dependencies.
The engines field in package.json specifies the JavaScript engines and their versions that are compatible with the project. It helps ensure that the project runs correctly on the specified engines and prevents installation on incompatible engines. This is crucial for compatibility and stability.

What is the impact of using JOIN operations on the performance of SQL queries?

  • JOIN operations can improve query performance by reducing the need for multiple queries, but they can also slow down queries if used improperly or on large datasets.
  • JOIN operations have no impact on query performance.
  • JOIN operations always improve query performance.
  • JOIN operations can only be used with small datasets.
JOIN operations can significantly impact query performance. While they can help combine data from multiple tables, they can also introduce complexity and reduce performance if not used efficiently.

To ensure the integrity of uploaded files, it is essential to verify their ______ after they are uploaded.

  • File Hashes
  • Metadata
  • File Size
  • File Type
To ensure the integrity of uploaded files, it is essential to verify their "File Hashes" after they are uploaded. File hashes are cryptographic checksums that can be compared before and after transmission to detect any changes or corruption in the file. Metadata, file size, and file type can provide additional information about the file but do not guarantee its integrity.

Which of the following statements is true regarding JavaScript's symbol data type?

  • Symbols can be used as property keys in objects, but they are not unique.
  • Symbols are always visible in the global scope.
  • Symbols are automatically garbage collected.
  • Symbols are of the same data type as strings.
Symbols in JavaScript can be used as property keys in objects, and they are guaranteed to be unique. This uniqueness makes them useful for defining non-colliding property names.

What would be the output of typeof NaN in JavaScript?

  • number
  • null
  • string
  • undefined
The output of typeof NaN in JavaScript is 'number'. This might seem counterintuitive, but it's because NaN is considered a numeric data type in JavaScript.

You are developing a Node.js application that receives binary data from a TCP stream. Which Node.js construct would you use to handle this binary data efficiently?

  • Buffer
  • Array
  • String
  • Number
In Node.js, the Buffer construct is specifically designed for handling binary data efficiently. It allows you to work with raw binary data directly. The other options (Array, String, Number) are not suitable for handling binary data efficiently.

When implementing a transform stream, which method should be implemented to handle the transformation of chunks?

  • _transform
  • _read
  • _write
  • _pipe
When implementing a transform stream in Node.js, you should implement the _transform method. This method receives input data in chunks and allows you to process and transform the data before passing it downstream. The other options are not specific to transform streams.

What is a Closure in JavaScript?

  • A function with no parameters.
  • A function that can be called only once.
  • A function that has access to its own scope, as well as the outer (enclosing) function's scope.
  • A function that returns a random value.
In JavaScript, a closure is a function that has access to its own scope, as well as the outer (enclosing) function's scope. This allows it to capture and remember values from the outer function even after the outer function has finished executing.

How can you catch synchronous errors occurring in a route handler in Express?

  • Using try-catch blocks
  • Using the catchError method
  • Adding the error event listener
  • Using the next() function
You can catch synchronous errors occurring in a route handler in Express by using try-catch blocks. This allows you to capture errors and handle them within your route handler function. The other options are not the typical way to catch synchronous errors in Express.