Welcome to Set 7 of our 100+ Spring Boot MCQ Questions and Answers series. This Set 7 continues from MCQs 61-70 and covers Spring Boot and Spring annotations.
Complete Spring Boot MCQ Questions and Answers series:
Spring Boot MCQ Questions and Answers | Set 1
Spring Boot MCQ Questions and Answers | Set 2
Spring Boot MCQ Questions and Answers | Set 3
Spring Boot MCQ Questions and Answers | Set 4
Spring Boot MCQ Questions and Answers | Set 5
Spring Boot MCQ Questions and Answers | Set 6
Spring Boot MCQ Questions and Answers | Set 7
Spring Boot MCQ Questions and Answers | Set 8
Spring Boot MCQ Questions and Answers | Set 9
Spring Boot MCQ Questions and Answers | Set 10
61. In Spring Boot, which annotation is used to create asynchronous methods?
Answer:
Explanation:
The @Async annotation in Spring Boot is used to indicate that a method should run asynchronously. It can be applied to methods that need to be executed in a separate thread.
62. What is the primary purpose of the @EnableJpaAuditing annotation in Spring Boot?
Answer:
Explanation:
The @EnableJpaAuditing annotation in Spring Boot enables JPA Auditing. It allows for the automatic population of audit-related fields in JPA entities, such as creation and modification dates.
63. How does Spring Boot support OAuth2 for securing applications?
Answer:
Explanation:
Spring Boot supports OAuth2 for securing applications by providing the spring-boot-starter-oauth2-client dependency. It simplifies the integration with OAuth2 providers for authentication and authorization.
64. In Spring Boot, what is the purpose of the @ExceptionHandler annotation?
Answer:
Explanation:
The @ExceptionHandler annotation in Spring Boot is used within a controller to define methods for handling specific exceptions thrown during executing controller methods.
65. What is the primary use of the @Transactional annotation in Spring Boot?
Answer:
Explanation:
The @Transactional annotation in Spring Boot is used to manage transactions declaratively. It can be applied to classes or methods to define the scope of a transactional operation.
66. How does Spring Boot simplify the deployment of web applications?
Answer:
Explanation:
Spring Boot simplifies the deployment of web applications by embedding servlet containers like Tomcat, Jetty, or Undertow. This allows Spring Boot applications to run as standalone jars without needing an external server.
67. What is the primary role of the @RestController annotation in Spring Boot?
Answer:
Explanation:
The @RestController annotation is used in Spring Boot to create RESTful web services. It is a convenient annotation that combines @Controller and @ResponseBody and ensures that data returned by each method is written straight into the response body.
68. How does Spring Boot simplify the development of web applications?
Answer:
Explanation:
Spring Boot simplifies the development of web applications by auto-configuring Spring MVC, which reduces the need to specify configuration settings manually.
69. What is the function of the @RequestMapping annotation in Spring Boot?
Answer:
Explanation:
The @RequestMapping annotation is used to map web requests to handler methods in controller classes. It can be used for any HTTP method and supports advanced configuration options.
70. What is the purpose of the @ResponseBody annotation in a Spring Boot controller?
Answer:
Explanation:
The @ResponseBody annotation indicates that the return value of a controller method should be used as the request's response body.
❮ Previous Set Next Set ❯
Comments
Post a Comment
Leave Comment