Springboot MCQs with answers Page - 18

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. What does the @ConditionalOnProperty annotation do?

  • (A) Loads a bean based on the presence of a system property
  • (B) Loads properties conditionally at runtime
  • (C) Loads a configuration class based on the property value
  • (D) Disables a bean if a property is missing

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to prevent a bean from being created automatically?

  • (A) @Bean(false)
  • (B) @DisableAutoCreate
  • (C) @Conditional(false)
  • (D) @ConditionalOnMissingBean

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation allows you to create a new thread-safe service layer class?

  • (A) @Service
  • (B) @Repository
  • (C) @ThreadSafe
  • (D) @Component

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to log method execution time using Spring AOP?

  • (A) @LogTime
  • (B) @ExecutionLogger
  • (C) @Around
  • (D) @TimeTrack

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the default format of application.yml file?

  • (A) XML
  • (B) JSON
  • (C) YAML
  • (D) Plain Text

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation can be used to perform data validation on fields?

  • (A) @Validate
  • (B) @Assert
  • (C) @Valid
  • (D) @Check

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does the property spring.jpa.hibernate.ddl-auto=update do?

  • (A) Disables table creation
  • (B) Drops all tables
  • (C) Updates the schema without destroying data
  • (D) Deletes all rows from tables

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which of the following is used to define a global exception handler?

  • (A) @RestControllerAdvice
  • (B) @ExceptionGlobal
  • (C) @GlobalErrorHandler
  • (D) @ExceptionCatch

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which file extension is valid for external Spring configuration files?

  • (A) .xml
  • (B) .config
  • (C) .properties
  • (D) .txt

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used for mapping POST requests in Spring Boot?

  • (A) @PostMapping
  • (B) @PostRequest
  • (C) @POST
  • (D) @PostAPI

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