Springboot MCQs with answers Page - 13

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 is the primary purpose of @Value annotation in Spring Boot?

  • (A) To create a new bean
  • (B) To enable caching
  • (C) To inject values from application.properties or environment variables
  • (D) To define application routes

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to map a request parameter to a method parameter?

  • (A) @PathVariable
  • (B) @RequestParam
  • (C) @Param
  • (D) @GetVariable

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How can you change the embedded server port in Spring Boot?

  • (A) Set server.port in application.properties
  • (B) Use @Port annotation
  • (C) Modify server.xml
  • (D) It cannot be changed

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of @RequestHeader annotation?

  • (A) To bind request header values to method parameters
  • (B) To define HTTP headers
  • (C) To inject custom headers into beans
  • (D) To send data in response headers

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which Spring Boot component helps define beans conditionally?

  • (A) @EnableConfig
  • (B) @Conditional
  • (C) @Profile
  • (D) @BeanConfig

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to bind multiple request parameters into a single bean?

  • (A) @RequestBean
  • (B) @RequestObject
  • (C) @ModelAttribute
  • (D) @RequestParams

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of spring.jpa.show-sql=true?

  • (A) Enables security logs
  • (B) Shows executed SQL statements in logs
  • (C) Enables exception logging
  • (D) Prints server port on console

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which class is the entry point of a Spring Boot application?

  • (A) MainApplication
  • (B) ApplicationStart
  • (C) SpringBootApp
  • (D) A class annotated with @SpringBootApplication

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How do you specify the database driver class name in Spring Boot?

  • (A) spring.datasource.driverClassName
  • (B) db.driver
  • (C) database.driver.name
  • (D) spring.db.driverClass

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does the @Profile annotation do?

  • (A) Defines an aspect
  • (B) Defines beans for specific environments
  • (C) Enables REST API logging
  • (D) Restricts method access

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