In EJS, to output data to the template, you use the <%= %> syntax, whereas to execute JavaScript code, you use the ______ syntax.

  • <%# %>
  • <%$ %>
  • <%* %>
  • <% %>
In EJS (Embedded JavaScript), you use <%= %> to output data to the template and <% %> to execute JavaScript code within the template. The other options are not valid EJS syntax.

To perform setup activities before every test case in a suite in Mocha, you can use the ______ hook.

  • before
  • beforeEach
  • setup
  • suiteSetup
In Mocha, the beforeEach hook is used to perform setup activities before every test case within a suite. It runs before each test case. The other options (before, setup, and suiteSetup) represent different hook names or are not used for this specific purpose in Mocha.

When connecting to a SQL database, what does the acronym CRUD stand for?

  • Create, Retrieve, Update, Delete
  • Connect, Retrieve, Utilize, Deploy
  • Configure, Render, Update, Distribute
  • Control, Receive, Use, Define
CRUD stands for Create, Retrieve, Update, Delete. These are the four fundamental operations for managing data in a SQL database. Create adds new records, Retrieve reads data, Update modifies existing records, and Delete removes records.

The Events module in Node.js extends the ______ class to allow the creation of event emitter instances.

  • 'EventEmitter'
  • 'Emitter'
  • 'Event'
  • 'Listener'
The Events module in Node.js extends the 'EventEmitter' class to allow the creation of event emitter instances. This class provides the functionality for registering event listeners and emitting events.

A JavaScript file that uses export is considered a ________.

  • Module
  • Package
  • Bundle
  • Dependency
A JavaScript file that uses the export keyword is considered a "module." Modules are used to encapsulate and export functionality that can be used in other parts of the code.

What is the primary purpose of the NPM registry in Node.js development?

  • To install Node.js itself
  • To manage global packages
  • To host and distribute Node.js packages and modules
  • To run JavaScript code
The primary purpose of the NPM (Node Package Manager) registry in Node.js development is to host and distribute Node.js packages and modules. It serves as a centralized repository for sharing and discovering reusable code, making it a crucial component of the Node.js ecosystem. Option 1 is incorrect because NPM is not used to install Node.js itself; you would use a Node.js installer for that. Option 2 is incorrect because NPM primarily manages packages on a project-specific level, not globally. Option 4 is incorrect because the NPM registry is not used to execute JavaScript code directly.

The Time-To-Live (TTL) value in caching determines how long the data should remain in the cache before being ______.

  • Refreshed
  • Expired
  • Serialized
  • Evicted
The Time-To-Live (TTL) value in caching determines how long the data should remain in the cache before being expired. When data expires, it is removed from the cache and, if needed, can be fetched again from the source.

What considerations need to be made for evolving schemas in distributed databases to ensure data consistency?

  • Distributed databases should never have evolving schemas
  • Schema changes should be applied simultaneously to all nodes
  • Schema changes should be applied sequentially with backward compatibility
  • Schema changes should be applied only to a single node
When evolving schemas in distributed databases, it's important to apply changes sequentially with backward compatibility. This means making changes in a way that allows both old and new versions of the schema to coexist temporarily, ensuring data consistency during the transition. Applying changes simultaneously or only to a single node can lead to data inconsistencies.

What is the primary difference between 'beforeEach' and 'beforeAll' hooks in Mocha?

  • beforeEach runs once before all test cases, while beforeAll runs before each test case.
  • beforeEach runs before each test case, while beforeAll runs once before all test cases.
  • beforeEach runs after each test case, while beforeAll runs once before all test cases.
  • beforeEach runs before each test case and has no equivalent to beforeAll.
In Mocha, the primary difference is that the beforeEach hook runs before each test case, ensuring a clean state for each test, while the beforeAll hook runs once before all test cases. This means that changes made in beforeEach won't persist between test cases, but changes in beforeAll will. The other options are incorrect regarding their behavior.

How do you ensure that your Express app is secure and defends against common web vulnerabilities?

  • Not using any middleware
  • Regularly updating Express to the latest version
  • Implementing security middleware, validating user inputs, and using secure coding practices
  • Hiding your server's IP address
To ensure that your Express app is secure and defends against common web vulnerabilities, you should implement security middleware, validate user inputs to prevent injection attacks, and follow secure coding practices to mitigate risks. Regularly updating Express is also essential for security.