Springboot MCQs with answers Page - 12

Here, you will find a collection of MCQ questions on Springboot. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which dependency is used to connect Spring Boot to MongoDB?

  • (A) spring-boot-starter-data-mongodb
  • (B) spring-boot-mongo-connector
  • (C) spring-boot-starter-nosql
  • (D) spring-boot-db-mongo

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which method is used to shut down a Spring Boot application programmatically?

  • (A) System.exit()
  • (B) SpringApplication.shutdown()
  • (C) SpringApplication.exit()
  • (D) ApplicationContext.shutdown()

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which Spring Boot starter would you use for messaging with RabbitMQ?

  • (A) spring-boot-starter-rabbit
  • (B) spring-boot-starter-mq
  • (C) spring-boot-starter-amqp
  • (D) spring-boot-starter-jms

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to run code before a bean is destroyed?

  • (A) @PreDestroy
  • (B) @DestroyBean
  • (C) @BeforeShutdown
  • (D) @Shutdown

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which of the following is NOT a valid Spring Boot actuator endpoint?

  • (A) /actuator/health
  • (B) /actuator/info
  • (C) /actuator/beans
  • (D) /actuator/ui

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How do you exclude a class from component scanning?

  • (A) @ComponentScan(exclude=...)
  • (B) @ComponentIgnore
  • (C) @ExcludeScan
  • (D) @IgnoreComponent

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does the SpringApplication.run() method return?

  • (A) Boolean
  • (B) String
  • (C) ApplicationContext
  • (D) Environment

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to define custom error handling methods?

  • (A) @ErrorHandler
  • (B) @ExceptionHandler
  • (C) @HandleError
  • (D) @OnError

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to mark a class as a Spring Boot configuration source?

  • (A) @SpringConfig
  • (B) @Configuration
  • (C) @SpringBootApplication
  • (D) @EnableConfig

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which classpath dependency is needed for validation annotations like @NotNull?

  • (A) javax.validation
  • (B) spring-boot-starter-validation
  • (C) spring-validation
  • (D) hibernate-validator

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ