Springboot MCQs with answers Page - 17

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 embedded servlet container is used by default in Spring Boot?

  • (A) Jetty
  • (B) Undertow
  • (C) Netty
  • (D) Tomcat

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to specify request mapping at the class level?

  • (A) @RequestMethod
  • (B) @ControllerPath
  • (C) @RequestMapping
  • (D) @Mapping

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which property is used to set the name of your Spring Boot application?

  • (A) application.name
  • (B) spring.application.name
  • (C) server.app.name
  • (D) boot.name

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation would you use to load a .properties file into Spring Environment?

  • (A) @PropertySource
  • (B) @LoadProperties
  • (C) @ConfigFile
  • (D) @FileLoad

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How can you configure multiple datasources in Spring Boot?

  • (A) By adding multiple datasource files
  • (B) Using XML configuration only
  • (C) Using @Primary and custom @Configuration classes
  • (D) Not supported in Spring Boot

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which dependency allows you to consume REST APIs in Spring Boot?

  • (A) spring-boot-starter-webclient
  • (B) spring-boot-rest-client
  • (C) spring-boot-api-consumer
  • (D) spring-boot-starter-client

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation can be used to mark a class as a configuration class?

  • (A) @AppConfig
  • (B) @Configuration
  • (C) @SpringBootApplication
  • (D) @BeanFactory

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of @EnableAutoConfiguration?

  • (A) Manually configure all beans
  • (B) Disable configurations
  • (C) Auto-configure beans based on classpath settings
  • (D) Load XML config only

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation helps create a singleton bean in Spring Boot?

  • (A) @Singleton
  • (B) @Scope("singleton")
  • (C) @SingleBean
  • (D) @SingleInstance

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How do you activate a specific profile in Spring Boot via command line?

  • (A) --spring.profiles.run=dev
  • (B) --profile.active=dev
  • (C) --spring.profiles.active=dev
  • (D) --set-profile=dev

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