Spring Boot MCQ Questions and Answers | Set 5


Welcome to Set 5 of our 100+ Spring Boot MCQ Questions and Answers series. This Set 5 continues from MCQs 41-50 and covers Spring Boot fundamentals 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

41. What is the primary use of the @Repository annotation in Spring Boot?

a) To define a REST controller
b) To mark a class as a repository, indicating database interaction
c) To create scheduled tasks
d) To configure application properties

42. In Spring Boot, what is the purpose of the spring-boot-starter-jdbc dependency?

a) To provide JDBC (Java Database Connectivity) support
b) To support Java Messaging Service (JMS)
c) To enable Spring Security features
d) To integrate with Apache Kafka

43. What is the purpose of the spring-boot-starter-aop dependency?

a) To provide support for Aspect-Oriented Programming
b) To enable RESTful web services
c) To add WebSocket communication capabilities
d) To provide batch processing functionalities

44. What is the primary role of the spring-boot-starter-cache dependency?

a) To support caching abstraction in Spring Boot applications
b) To provide email-sending capabilities
c) To enable WebSocket communication
d) To offer batch processing functionalities

45. How can you handle exceptions globally in a Spring Boot application?

a) By using the @ControllerAdvice annotation
b) Through individual try-catch blocks in each method
c) By configuring a global error handler in application.properties
d) By deploying a separate error handling service

46. What is the main purpose of the @EnableJpaRepositories annotation in Spring Boot?

a) To enable JPA repository support
b) To configure Spring Security
c) To define scheduled tasks
d) To enable Aspect-Oriented Programming

47. What is the role of the @Valid annotation in Spring Boot?

a) To ensure data validation in controller methods
b) To validate application properties
c) To validate SQL queries
d) To check the syntax of Java code

48. How is internationalization (i18n) typically implemented in Spring Boot?

a) By using a dedicated internationalization service
b) Through properties files for different locales
c) By hardcoding strings in the Java code
d) Using an external translation API

49. What is the primary purpose of the @ModelAttribute annotation in a Spring Boot web application?

a) To bind method parameters to named model attributes
b) To define a RESTful endpoint
c) To configure application security
d) To define a scheduled task

50. In Spring Boot, which starter dependency is typically used for developing web applications with Thymeleaf templates?

a) spring-boot-starter-thymeleaf
b) spring-boot-starter-web
c) spring-boot-starter-jdbc
d) spring-boot-starter-freemarker


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