Online Exam Quiz

questionQuestion  1 to 30

What does Dependency Injection (DI) enable in NestJS?

  • Better performance
  • Code reuse
  • Tight coupling
  • Simpler debugging
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

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

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

How can you handle database operations in NestJS?

  • By using the @Database() decorator
  • By defining a custom middleware
  • By using third-party libraries like TypeORM or Sequelize
  • By directly interacting with the database in controllers
Mark for review

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

  • Middleware
  • Components
  • Modules
  • Schemas
Mark for review

What is the purpose of middleware in NestJS?

  • To handle HTTP requests and responses
  • To manage database operations
  • To define application routes
  • To encapsulate business logic
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

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

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

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

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

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 dependency injection in NestJS?

  • To manage HTTP requests
  • To optimize database queries
  • To inject dependencies into components
  • To handle file uploads
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 decorator is used to define a controller in NestJS?

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

What is the primary language used in NestJS development?

  • Java
  • Python
  • TypeScript
  • PHP
Mark for review

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

  • GET
  • DELETE
  • PATCH
  • UPDATE
Mark for review

What does interception enable in NestJS?

  • Request validation
  • Response transformation
  • Error handling
  • Dependency injection
Mark for review

What is the purpose of a controller in NestJS?

  • To define application routes
  • To manage database connections
  • To handle middleware
  • To encapsulate business logic
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

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 does the @Module() decorator signify in NestJS?

  • It defines a service
  • It defines a controller
  • It defines a module
  • It defines a component
Mark for review

What is the primary purpose of guards in NestJS?

  • Data validation
  • Error handling
  • Authentication and authorization
  • Request routing
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

What is NestJS primarily built on top of?

  • Express.js
  • Django
  • Flask
  • Laravel
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

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