Springboot MCQs with answers Page - 14

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 dependency is required to use Spring Data JPA?

  • (A) spring-boot-starter-data-mongodb
  • (B) spring-boot-starter-data-jpa
  • (C) spring-data-sql
  • (D) spring-boot-starter-db

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How can you enable detailed debug logging in Spring Boot?

  • (A) Set debug=true in application.properties
  • (B) Add @EnableDebugLog annotation
  • (C) Set log.level.debug=true
  • (D) Call enableDebug() in main method

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation is used to expose a method's return value as the response body?

  • (A) @RestMapping
  • (B) @JsonBody
  • (C) @ResponseBody
  • (D) @Result

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation can be used to create RESTful web services easily?

  • (A) @RestController
  • (B) @WebService
  • (C) @Api
  • (D) @SpringEndpoint

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How can you define a custom error page in Spring Boot?

  • (A) Create a file named error.html in /resources/templates
  • (B) Define it in application.properties
  • (C) Add @CustomErrorPage annotation
  • (D) Define error.xml in resources

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. How do you enable HTTPS in Spring Boot?

  • (A) Set server.ssl.enabled=true and provide keystore settings
  • (B) Use @EnableHttps
  • (C) Enable it from the browser
  • (D) Run using SSLCommand class

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What is the purpose of actuator endpoints like /actuator/health?

  • (A) To track application traffic
  • (B) To monitor application health and metrics
  • (C) To expose APIs for user login
  • (D) To handle exceptions

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which Spring Boot starter is used to work with JMS?

  • (A) spring-boot-starter-queue
  • (B) spring-boot-starter-jms
  • (C) spring-boot-starter-msg
  • (D) spring-boot-starter-events

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. What does the @PathVariable annotation do?

  • (A) Maps query parameters to method arguments
  • (B) Binds URL template variables to method parameters
  • (C) Provides access to application path
  • (D) Defines the context path

S

Shyam Dubey • 3.70K Points
Extraordinary

Q. Which annotation can be used to expose a method as a REST endpoint in Spring Boot?

  • (A) @WebMethod
  • (B) @GetMapping
  • (C) @RestService
  • (D) @RemoteMethod