Spring Boot MCQ Questions and Answers | Set 3


Welcome to Set 3 of our 100 Spring Boot MCQ Questions and Answers series, where we continue to unravel the complexities of Spring Boot. Having built a solid foundation with the basics and intermediate topics covered in the first two sets, this third instalment elevates your learning journey into advanced Spring Boot features and 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

21. What is the purpose of the @ConfigurationProperties annotation in Spring Boot?

a) To define controller methods
b) To bind external configuration properties to a Java object
c) To create HTML templates
d) To configure Spring Security

22. Which dependency is used to include Spring Security in a Spring Boot project?

a) spring-boot-starter-security
b) spring-boot-starter-web
c) spring-boot-starter-data-jpa
d) spring-boot-starter-actuator

23. How does Spring Boot support database migrations?

a) Using the @Entity annotation
b) Through the Spring Data JPA
c) By integrating with tools like Flyway or Liquibase
d) By providing its own database migration tool

24. What is the default scope of a Spring bean in Spring Boot?

a) Prototype
b) Request
c) Singleton
d) Session

25. What is the purpose of the @Service annotation in Spring Boot?

a) To define a REST controller
b) To mark a class as a service provider
c) To create scheduled tasks
d) To configure application properties

26. What is the role of the spring-boot-starter-actuator dependency?

a) To provide RESTful web service capabilities
b) To add support for WebSocket communication
c) To enable Spring Security features
d) To include production-ready features like health indicators and metrics

27. How can you specify the profile-specific configuration in Spring Boot?

a) By creating separate XML files for each profile
b) By using annotations like @Profile
c) By naming property files with the profile name (e.g., application-dev.properties)
d) By defining environment variables

28. In Spring Boot, what is the purpose of the @Scheduled annotation?

a) To define a scheduled task
b) To configure a REST endpoint
c) To mark a class as a JPA entity
d) To define a service class

29. How does Spring Boot simplify database access?

a) By providing a built-in database
b) Through automatic configuration of DataSource and JdbcTemplate
c) By requiring manual configuration of database connections
d) By using XML configuration files

30. What is the role of the @RequestBody annotation in a Spring Boot controller?

a) To bind a method parameter to a web request body
b) To define a request parameter
c) To return a response body
d) To configure request headers

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


Comments

Spring Boot 3 Paid Course Published for Free
on my Java Guides YouTube Channel

Subscribe to my YouTube Channel (165K+ subscribers):
Java Guides Channel

Top 10 My Udemy Courses with Huge Discount:
Udemy Courses - Ramesh Fadatare