Springboot MCQs with answers Page - 5

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 define a method that should be executed after bean initialization?

  • (A) @Init
  • (B) @PostConstruct
  • (C) @AfterInit
  • (D) @Startup

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How do you define a custom banner in Spring Boot?

  • (A) Set banner=true in application.properties
  • (B) Place banner.txt in the resources folder
  • (C) Use @BannerConfig
  • (D) Use banner.xml file

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used for asynchronous method execution?

  • (A) @Async
  • (B) @Threaded
  • (C) @Scheduled
  • (D) @Background

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to map HTTP POST requests?

  • (A) @PostMapping
  • (B) @GetMapping
  • (C) @PutMapping
  • (D) @RequestMapping(method=RequestMethod.POST)

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the role of the application.properties file in Spring Boot?

  • (A) It contains the project structure
  • (B) It is used to define beans
  • (C) It provides configuration for the application
  • (D) It handles security settings only

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to enable caching in a Spring Boot application?

  • (A) @EnableCache
  • (B) @EnableCaching
  • (C) @Cacheable
  • (D) @CachingEnabled

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to mark a method's result for caching?

  • (A) @CachePut
  • (B) @CacheStore
  • (C) @Cacheable
  • (D) @EnableCaching

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which configuration file is used if both application.properties and application.yml exist?

  • (A) Only application.properties is used
  • (B) Only application.yml is used
  • (C) application.yml overrides application.properties
  • (D) application.properties overrides application.yml

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of @ConditionalOnProperty?

  • (A) To enable caching based on a property
  • (B) To load a bean only if a specific property is present
  • (C) To disable auto-configuration
  • (D) To define custom endpoints

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the role of Spring Boot CLI?

  • (A) To run SQL scripts
  • (B) To deploy JAR files
  • (C) To quickly develop Spring apps using Groovy
  • (D) To monitor server logs

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