n CRUD operations, which operation is used to modify existing data?
- Create
- Read
- Update
- Delete
The Update operation in CRUD (Create, Read, Update, Delete) operations is used to modify existing data in the system. It allows you to make changes to existing records.
The Access-Control-Allow-Methods header in CORS specifies which HTTP ________ are allowed.
- methods
- verbs
- headers
- origins
The Access-Control-Allow-Methods header in CORS specifies which HTTP methods are allowed for cross-origin requests. It should include a comma-separated list of HTTP methods such as GET, POST, PUT, DELETE, etc.
Improper handling of dependencies and devDependencies can lead to larger ________ sizes when deploying an application.
- bundle
- package
- container
- memory
Improper handling of dependencies and devDependencies can lead to larger bundle sizes when deploying an application. When you include unnecessary dependencies, your application's bundle size increases, impacting load times and performance.
In Express.js, to serve static files, you generally use the ______ middleware.
- static
- middleware
- server
- file
In Express.js, to serve static files, you generally use the static middleware. This middleware allows you to serve files such as images, CSS, and JavaScript to clients.
Which of the following is a common technique used for optimizing database queries?
- Query caching
- Adding more indexes
- Increasing database complexity
- Ignoring query performance
One common technique used for optimizing database queries is query caching. It involves storing frequently used query results in memory, reducing the need to re-execute the same query, and improving response times.
If a package is required for running the tests, it should ideally be listed under ________.
- devDependencies
- dependencies
- peerDependencies
- optionalDependencies
If a package is required for running the tests, it should ideally be listed under devDependencies. This ensures that the testing dependencies are only installed during development and testing phases, keeping the production environment clean from unnecessary packages.
You are designing a logging system in Node.js where multiple loggers are listening to logging events. How would you manage and optimize the event listeners to avoid potential memory leaks?
- event.setMaxListeners(1)
- event.on('log', loggerCallback)
- event.prependListener('log', loggerCallback)
- event.removeListener('log', loggerCallback)
To avoid memory leaks when multiple loggers are listening to logging events, it's crucial to remove listeners when they are no longer needed. The event.removeListener() method should be used to remove specific listeners, ensuring that you free up memory and resources when loggers are no longer required. The other options are related to listener management but do not directly address memory leaks.
In ESLint, the ______ property in the configuration file can be used to define global variables.
- Globals
- Environment
- Globals
- Rules
In ESLint, the globals property in the configuration file is used to define global variables that are accessible throughout your code without triggering linting errors. This allows you to specify variables that are declared externally or provided by the environment. The environment option is used to specify which environments your code runs in, but it's not used to define individual global variables. The rules property is used for configuring ESLint rules.
In Jest, to isolate a module from its dependencies for more focused unit testing, you would use ______.
- mock
- stub
- spy
- inject
In Jest, you can use the mock function to isolate a module from its dependencies. This allows you to replace the real dependencies with mock implementations for focused unit testing.
When using the rest operator in a function’s parameters, it will collect the remaining arguments into an ______.
- Array
- Object
- String
- Argument
When using the rest operator (...) in a function's parameters, it will collect the remaining arguments into an "Array." This allows you to work with variable-length argument lists easily.