What is the default scope of a provider in NestJS?
Module-scoped
Request-scoped
Singleton
Transient
What is the order of execution for middleware applied at the controller and route level in NestJS?
Route-level middleware executes first, followed by controller-level middleware.
Controller-level middleware executes first, followed by route-level middleware.
The order can be controlled using a priority setting.
The order of execution is undefined.
What is the primary programming language used for developing NestJS applications?
Python
Java
JavaScript
C#
Which decorator is used to define an Interceptor class in NestJS?
@Module()
@Interceptor()
@Controller()
@Injectable()
How do you access the request body in a NestJS controller?
Using the @Body() decorator
@Body()
Through the context object
context
Using req.body
req.body
Accessing request.data
request.data
Which of the following is NOT a valid HTTP method for defining routes in NestJS?
RENDER
DELETE
PUT
PATCH
What is the difference between a provider and a service in NestJS?
Providers are classes that can be injected as dependencies, while a service is a specific type of provider with business logic.
Providers and services are essentially the same thing, with no real distinction.
Providers are used for database operations, while services handle business logic.
Providers are decorated with @Injectable(), while services are decorated with @Service().
Can a Controller access a Service's methods in NestJS?
Only if the Controller and Service are defined in the same module.
Yes, by injecting the Service into the Controller's constructor.
No, Controllers and Services are completely isolated.
Yes, by using static methods of the Service.
What is the role of CallHandler in the intercept method of an Interceptor?
CallHandler
intercept
It handles errors thrown within the Interceptor.
It represents the next Interceptor in the chain or the route handler itself.
It provides access to the dependency injection container.
It provides utility methods for transforming the request object.
When using an Interceptor to modify the response, what is the best way to ensure type safety?
Type casting within the Interceptor.
Disabling type checks within the Interceptor.
Using generics with the NestInterceptor interface.
NestInterceptor
Type checking is not necessary within Interceptors.