Online Exam Quiz

questionQuestion  1 to 30

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

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 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 decorator is used to inject a service into a controller in NestJS?

  • @Inject
  • @Service
  • @Injectable
  • @InjectableService
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

What does the @Injectable() decorator signify in NestJS?

  • It indicates that the class is a service
  • It indicates that the class is a controller
  • It indicates that the class is a module
  • It indicates that the class is a middleware
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 command is used to create a new NestJS application?

  • ng new
  • nest new
  • npm create nest
  • create-nest-app
Mark for review

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

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

What is NestJS?

  • A database management system
  • A TypeScript-based Node.js framework
  • A front-end JavaScript library
  • An operating system kernel
Mark for review

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

  • Middleware
  • Components
  • Modules
  • Schemas
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

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

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

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

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

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

What programming language does NestJS primarily use?

  • Python
  • JavaScript
  • TypeScript
  • Java
Mark for review

What is the purpose of DTOs (Data Transfer Objects) in NestJS?

  • To define database schemas
  • To encapsulate data validation logic
  • To define service interfaces
  • To manage authentication
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

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 of the following is NOT a valid lifecycle hook in NestJS?

  • onInit
  • afterContentInit
  • onModuleInit
  • ngOnInit
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

What is the primary role of guards in NestJS?

  • Data validation
  • Error handling
  • Authentication and authorization
  • Request routing
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 is the purpose of the @Injectable() decorator in NestJS?

  • It indicates that the class is a module
  • It indicates that the class is a controller
  • It indicates that the class is a service
  • It indicates that the class is a middleware
Mark for review

What is NestJS primarily built on top of?

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

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

  • GET
  • DELETE
  • PATCH
  • UPDATE
Mark for review

What does NestJS use as its primary programming language?

  • Java
  • TypeScript
  • Python
  • Ruby
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

What is the primary purpose of pipes in NestJS?

  • Data transformation
  • Handling HTTP requests
  • Validating input data
  • Defining application routes
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