How can you define multiple route paths for a single controller method in NestJS?
By using the @Routes() decorator
@Routes()
By defining multiple methods for each path
It's not possible to have multiple paths for one method
By using an array of strings as the route path
What is the primary purpose of exception handling in a NestJS backend application?
To define middleware functions for request-response cycles.
To enforce strict data typing in controller methods.
To handle database migrations and schema changes.
To gracefully handle and respond to unexpected errors during request processing.
Which of these features is NOT a primary advantage of using NestJS?
Provides a command-line interface (CLI) for easy project setup
Directly renders dynamic user interfaces in the browser
Encourages code organization through modules and providers
Leverages TypeScript for improved code structure and maintainability
What is the role of Providers in NestJS?
To define the application's entry point.
To handle data persistence.
To provide dependencies that can be injected into other components like controllers or services.
To render UI elements.
What is the core purpose of NestJS?
Managing and interacting with databases directly
Developing efficient and scalable server-side applications
Automating code deployment and server configuration
Building interactive front-end web applications
What is the default scope of a provider in NestJS?
Transient
Module-scoped
Singleton
Request-scoped
How do you inject a provider from a different module in NestJS?
By creating a new instance of the provider using its constructor.
By accessing the global NestJS container.
By importing the module containing the provider into the module where you need it.
By using the @Inject() decorator and specifying the provider's class name.
@Inject()
Inside an Interceptor's intercept method, what object allows you to modify the response?
intercept
ctx.request
interceptor.transform()
ctx.response
next.handle()
What is the primary function of a module in NestJS?
To handle HTTP requests and responses.
To interact with databases and external APIs.
To organize code into related units and manage dependencies.
Which interface does a custom exception filter in NestJS need to implement?
CanActivate
HttpException
ExceptionFilter
Injectable