What considerations should be made when implementing full-text search to ensure relevance and accuracy of search results?

  • Stemming and lemmatization
  • Exact matching
  • Case sensitivity
  • Shortening query length
When implementing full-text search, considerations should include stemming and lemmatization to handle variations of words (e.g., "run," "running," "ran"). This ensures that search results are more comprehensive and relevant. Exact matching alone may miss variations. Case sensitivity should be considered based on user requirements. Shortening query length may lead to the exclusion of important search terms.

In a Cache-Aside strategy, when is the data loaded into the cache?

  • Data is loaded into the cache on write operations.
  • Data is loaded into the cache on read operations.
  • Data is automatically loaded when the cache is initialized.
  • Data is loaded into the cache periodically on a fixed schedule.
In a Cache-Aside strategy, data is not automatically loaded into the cache. Instead, it's loaded explicitly on read operations when an application requests the data.

How does the use of mocking and stubbing affect the isolation of unit tests?

  • It increases isolation by replacing real dependencies with controlled substitutes.
  • It reduces isolation by relying on actual dependencies.
  • It has no effect on isolation.
  • It increases isolation by running tests concurrently.
The use of mocking and stubbing in unit tests increases isolation by replacing real dependencies, such as external services or APIs, with controlled substitutes. This allows you to focus on testing the specific unit of code without worrying about the behavior of the real dependencies. Option (2) is incorrect because relying on actual dependencies doesn't create isolation in unit tests. Options (3) and (4) are also incorrect.

How can middleware be added to an Express application to process requests?

  • Using the use() method
  • Using the get() method
  • Using the addMiddleware() function
  • Using the handleRequest() method
Middleware can be added to an Express application using the use() method. This method allows you to specify middleware functions that can process requests in the order they are defined. The other options are not standard ways of adding middleware in Express.

You are maintaining a library, and you need to release a new version that fixes a bug but also changes the behavior of an existing feature. How should you update the version number according to semantic versioning?

  • 1.0.0
  • 1.1.0
  • 2.0.0
  • 1.0.1
According to semantic versioning (SemVer), when you make backward-incompatible changes or breaking changes, you should increment the major version. In this scenario, since the behavior change affects existing users, you should update to version 2.0.0.

Which command is used to install a Node.js package globally?

  • npm global install
  • npm i -g
  • npm install -g
  • npm add -g
To install a Node.js package globally, you should use the npm install -g command. This makes the package available for use across different projects. The other options may not work as expected or are not the recommended way to install packages globally.

When implementing indexing, what factors should be considered to mitigate the impact on database write performance?

  • Selective indexing
  • Index maintenance strategy
  • Using index-only scans
  • Increasing index size
When implementing indexing, factors to consider for mitigating the impact on write performance include selective indexing (indexing only the columns that are frequently queried), choosing an appropriate index maintenance strategy (e.g., periodic maintenance rather than immediate updates), and using index-only scans to reduce disk I/O during reads. Increasing the index size can have a negative impact on write performance, so it should be done judiciously.

In Node.js, how can data be written to a writable stream?

  • Using the read() method
  • Using the write() method
  • Using the pipe() method
  • Using the readable() method
Data can be written to a writable stream in Node.js using the write() method. This method allows you to write data to the stream, which can be a file, network connection, or any other writable destination. The pipe() method is used for piping data from a readable stream to a writable stream, and the other options are not the correct ways to write data to a writable stream.

To perform an action once a Promise is settled, regardless of its outcome, you can use the .finally() method, which is called on the ________ of a Promise.

  • rejection
  • resolution
  • completion
  • termination
To perform an action once a Promise is settled, regardless of whether it's fulfilled or rejected, you can use the .finally() method. This method is called on the "completion" of a Promise. It's often used for cleanup operations.

You are tasked with implementing an authentication system for your Express API. What considerations should you make regarding security, user experience, and scalability when choosing an authentication strategy?

  • Use JWT (JSON Web Tokens) with long expiration times.
  • Store plain text passwords in the database.
  • Implement OAuth 2.0 for social login only.
  • Use basic authentication over HTTP.
Using JWT with long expiration times might seem like a convenient option for user experience, but it could pose a security risk. Storing plain text passwords is a severe security vulnerability. Implementing OAuth 2.0 for social login only might not be sufficient for all authentication needs. Using basic authentication over HTTP is not secure. A robust authentication strategy should consider security (option 1) without compromising user experience and