In Express, ______ is used to match any route that has not been matched by earlier routes.

  • default
  • fallback
  • wildcard
  • catch-all
In Express.js, a catch-all or wildcard route is used to match any route that has not been matched by earlier routes. This is often used for creating custom error handlers or handling undefined routes.

How can you pass data from your Express route handler to your EJS view?

  • res.render('view', dataObject);
  • req.send('view', dataObject);
  • res.render('view', dataObject);
  • res.send('view', dataObject);
You can pass data from your Express route handler to your EJS view using the res.render('view', dataObject); method. This method renders the EJS view and includes the data in the view template, making it accessible for rendering dynamic content. The other options are not valid ways to pass data to EJS views.

Which property in the package.json file is used to define scripts that can be run with npm?

  • scripts
  • commands
  • npm-scripts
  • tasks
In the package.json file, the scripts property is used to define custom scripts that can be run using npm commands. This property allows you to define various scripts such as "start," "test," or custom scripts for tasks like building, linting, or deploying your application.

The spread operator can be used to merge two ______ into a new one, combining their properties.

  • Arrays
  • Objects
  • Strings
  • Functions
The spread operator can be used to merge two "Objects" into a new one, combining their properties. It's a useful way to create a new object with properties from multiple source objects.

What is the main purpose of using mocking in unit testing?

  • To simulate the behavior of external dependencies
  • To improve code readability
  • To optimize code execution
  • To enforce code standards
Mocking in unit testing is primarily used to simulate the behavior of external dependencies, such as databases, APIs, or services, so that the unit being tested can be isolated and tested in isolation. This helps ensure that tests focus on the unit's logic without relying on the actual external dependencies.

The aud claim in a JWT token represents the ________ for which the JWT is intended.

  • Audience
  • Issuer
  • Expiration
  • Subject
The "aud" (audience) claim in a JWT (JSON Web Token) represents the intended audience for which the JWT is intended. It specifies the recipients or systems that are expected to process the token. The "iss" (issuer) claim (Option 2) identifies the entity that issued the token. The "exp" (expiration) claim (Option 3) indicates the time after which the token should not be accepted. The "sub" (subject) claim (Option 4) typically identifies the subject of the token, often the user or system the token represents.

In JavaScript, the ______ method is used to iterate over all enumerable properties of an object.

  • for loop
  • forEach
  • while loop
  • iterate
The forEach method is used in JavaScript to iterate over all enumerable properties of an object. It is commonly used with arrays to perform an action on each item. The for loop and while loop are general looping constructs and not specific to object iteration. iterate is not a standard method.

Which of the following methods in JavaScript will remove the last element from an array and return that element?

  • pop()
  • shift()
  • splice()
  • unshift()
The pop() method in JavaScript is used to remove the last element from an array and return that element. It modifies the original array by removing the last element. The other options (shift(), splice(), and unshift()) are used for different array operations.

Which of the following is true regarding built-in middlewares in Express.js?

  • Built-in middlewares cannot be customized or extended.
  • You can modify the behavior of built-in middlewares, but you cannot remove them.
  • Built-in middlewares can be completely disabled if not needed.
  • You can add custom middlewares, but built-in ones cannot be used.
In Express.js, you can completely disable built-in middlewares if they are not needed, allowing for customization and control over the middleware stack.

Which of the following is a purpose of using authentication strategies in web development?

  • Ensure data integrity
  • Verify the server's hardware
  • Verify the client's hardware
  • Verify the user's identity
Authentication strategies in web development are used to verify the user's identity. They play a crucial role in ensuring that the users accessing a system or application are who they claim to be. The other options, such as ensuring data integrity and verifying hardware, are not the primary purposes of authentication strategies.