Springboot MCQs with answers Page - 7

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 annotation is used to handle exceptions globally in Spring Boot?

  • (A) @GlobalException
  • (B) @ExceptionMapper
  • (C) @ControllerAdvice
  • (D) @ErrorHandler

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does @ResponseStatus do in Spring Boot?

  • (A) It sets the response status code for an exception or controller method
  • (B) It handles request mapping
  • (C) It maps headers
  • (D) It enables auto-configuration

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of @SpringBootConfiguration?

  • (A) To enable web security
  • (B) To define a Spring Boot configuration class
  • (C) To create test beans
  • (D) To generate database schema

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which starter would you use to add security support in a Spring Boot app?

  • (A) spring-boot-starter-security
  • (B) spring-boot-starter-auth
  • (C) spring-boot-starter-oauth2
  • (D) spring-boot-starter-user

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How can you disable a specific auto-configuration class?

  • (A) Use @DisableConfig
  • (B) Use @SpringBootApplication(exclude = ...)
  • (C) Use application.properties
  • (D) Remove the dependency

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of the @JsonIgnore annotation?

  • (A) To ignore bean methods
  • (B) To skip a field during JSON serialization
  • (C) To prevent injection
  • (D) To ignore application.properties

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which dependency provides support for working with Thymeleaf templates?

  • (A) spring-boot-starter-jdbc
  • (B) spring-boot-starter-thymeleaf
  • (C) spring-boot-starter-data-jpa
  • (D) spring-boot-starter-templates

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to autowire a bean by its type?

  • (A) @Resource
  • (B) @Inject
  • (C) @Autowired
  • (D) @BeanInject

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation allows a method to execute after application startup?

  • (A) @PostLoad
  • (B) @StartupMethod
  • (C) @PostConstruct
  • (D) @InitMethod

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which property sets the context path of a Spring Boot application?

  • (A) server.root.path
  • (B) spring.context.path
  • (C) server.servlet.context-path
  • (D) server.contextRoot

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