Online Exam Quiz

questionQuestion  1 to 30

What is the purpose of a service in NestJS?

  • To define application routes
  • To encapsulate business logic and share data between components
  • To handle HTTP requests
  • To manage database connections
Mark for review

What does NestJS use as its primary programming language?

  • Java
  • TypeScript
  • Python
  • Ruby
Mark for review

Which of the following is true about providers in NestJS?

  • Providers are only used for database operations
  • Providers are singletons by default
  • Providers cannot be injected into other components
  • Providers are only used for logging
Mark for review

Which command is used to start a NestJS application in development mode?

  • nest start
  • npm run start
  • npm run dev
  • node server.js
Mark for review

How can you configure authentication in NestJS?

  • By using the @Authentication() decorator
  • By defining middleware to handle authentication logic
  • By setting up a third-party authentication provider
  • By using the built-in AuthGuard class
Mark for review

How can you handle file uploads in NestJS?

  • By using the @FileUpload() decorator
  • By configuring middleware to parse multipart/form-data
  • By using the fs module from Node.js
  • By defining a custom interceptor
Mark for review

How can you handle CORS (Cross-Origin Resource Sharing) in NestJS?

  • By using the @CrossOrigin() decorator
  • By configuring CORS in the nest-cli.json file
  • By setting CORS headers in middleware
  • By using the @EnableCors() decorator
Mark for review

What does serialization enable in NestJS?

  • Efficient database queries
  • Type checking
  • Conversion of JSON data to class instances and vice versa
  • Secure authentication
Mark for review

What is the purpose of dependency injection in NestJS?

  • To manage HTTP requests
  • To optimize database queries
  • To inject dependencies into components
  • To handle file uploads
Mark for review

Which decorator is used to inject a service into a controller in NestJS?

  • @Inject
  • @Service
  • @Injectable
  • @InjectableService
Mark for review

Which of the following is NOT a valid HTTP method in NestJS?

  • GET
  • DELETE
  • PATCH
  • UPDATE
Mark for review

What is the primary purpose of a service in NestJS?

  • To define application routes
  • To encapsulate business logic and share data between components
  • To handle HTTP requests
  • To manage database connections
Mark for review

Which of the following is true about modules in NestJS?

  • Modules are optional in NestJS applications
  • Modules are a collection of components, controllers, services, and more
  • NestJS doesn't support modules
  • Modules can only contain controllers
Mark for review

What does Dependency Injection (DI) enable in NestJS?

  • Better performance
  • Code reuse
  • Tight coupling
  • Simpler debugging
Mark for review

Which of the following is NOT a core concept in NestJS?

  • Middleware
  • Components
  • Modules
  • Schemas
Mark for review

In NestJS, which decorator is used to inject dependencies into a component?

  • @Injectable
  • @Inject
  • @Dependency
  • @Component
Mark for review

What is Dependency Injection (DI) in NestJS?

  • A way to inject dependencies into components
  • A method for executing asynchronous tasks
  • A data encryption technique
  • A form of HTML injection vulnerability
Mark for review

Which of the following is true about interceptors in NestJS?

  • Interceptors can only modify request data
  • Interceptors execute before guards in the request pipeline
  • Interceptors cannot be used for logging
  • Interceptors are only used for error handling
Mark for review

Which of the following is NOT a valid parameter decorator in NestJS?

  • @Body()
  • @Param()
  • @Query()
  • @Header()
Mark for review

What is NestJS primarily built on top of?

  • Express.js
  • Django
  • Flask
  • Laravel
Mark for review

What is the purpose of guards in NestJS?

  • To validate request data
  • To handle HTTP responses
  • To implement authentication and authorization logic
  • To define application routes
Mark for review

What is the purpose of the @Controller() decorator in NestJS?

  • To define a service
  • To define a module
  • To define a middleware
  • To define a controller
Mark for review

How can you configure logging in NestJS?

  • By using the @Logger() decorator
  • By setting up a logging provider in the module
  • By configuring logging in the nest-cli.json file
  • By using the console.log() function
Mark for review

How can you handle Cross-Origin Resource Sharing (CORS) in NestJS?

  • By using the @CrossOrigin() decorator
  • By using the @CrossOrigin() decorator
  • By setting CORS headers in middleware
  • By using the @EnableCors() decorator
Mark for review

What is the purpose of Dependency Injection (DI) in NestJS?

  • To inject dependencies into components
  • To manage HTTP requests
  • To handle database operations
  • To define application routes
Mark for review

How can you handle errors globally in NestJS?

  • By using the @ErrorHandler() decorator
  • By defining an exception filter
  • By setting up a catch-all route
  • By using the try...catch statement in controllers
Mark for review

Which of the following is NOT a valid lifecycle hook in NestJS?

  • onInit
  • afterContentInit
  • onModuleInit
  • ngOnInit
Mark for review

What is the purpose of pipes in NestJS?

  • To define data models
  • To handle HTTP requests
  • To transform data between the client and server
  • To validate input data
Mark for review

What is the purpose of serialization in NestJS?

  • To optimize database queries
  • To convert JSON data to class instances and vice versa
  • To encrypt sensitive information
  • To define API routes
Mark for review

Which decorator is used to define a controller in NestJS?

  • @Service
  • @Component
  • @Controller
  • @Module
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review