Welcome to Set 9 of our 100+ Spring Boot MCQ Questions and Answers series. This Set 9 continues from MCQs 81-90 and covers Spring Boot and Spring framework modules.
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
81. Which Spring Boot starter is used for integrating the MongoDB NoSQL database?
Answer:
Explanation:
The spring-boot-starter-data-mongodb starter is used for integrating MongoDB, a NoSQL database, into Spring Boot applications. It provides support for MongoDB operations.
82. In Spring Boot, how can you access the H2 database's web console in development?
Answer:
Explanation:
In development, you can access the H2 database's web console in a Spring Boot application by setting spring.h2.console.enabled to true in application.properties.
83. In Spring Boot, which annotation is used to define SQL queries in repository interfaces?
Answer:
Explanation:
The @Query annotation in Spring Boot is used to define custom SQL queries in repository interfaces. It allows specifying the query directly on the repository method.
84. How can you define a JPA repository in Spring Boot?
Answer:
Explanation:
In Spring Boot, JPA repositories are typically defined as interfaces that extend CrudRepository or JpaRepository. These interfaces provide methods for common CRUD operations.
85. What is the role of the JpaRepository interface in Spring Boot?
Answer:
Explanation:
The JpaRepository interface in Spring Boot is a JPA specific extension of the Repository interface. It offers a central repository abstraction for JPA entities.
86. Which Spring Boot starter is used for integrating the Elasticsearch NoSQL database?
Answer:
Explanation:
The spring-boot-starter-data-elasticsearch starter is used to integrate Elasticsearch, a NoSQL search and analytics engine, into Spring Boot applications.
87. What is the purpose of the @GeneratedValue annotation in a JPA entity?
Answer:
Explanation:
The @GeneratedValue annotation in a JPA entity is used to automatically generate primary key values. It is typically used in conjunction with the @Id annotation.
88. How does Spring Boot support Redis caching?
Answer:
Explanation:
Spring Boot supports Redis caching by providing the spring-boot-starter-data-redis dependency. This starter simplifies the configuration and use of Redis as a cache and message broker.
89. What is the primary role of the MongoRepository interface in Spring Boot?
Answer:
Explanation:
The MongoRepository interface in Spring Boot provides a central repository abstraction for MongoDB operations. It extends the CrudRepository interface with MongoDB-specific operations.
90. In Spring Boot, how can you enable automatic schema generation for JPA entities?
Answer:
Explanation:
Automatic schema generation for JPA entities in Spring Boot can be enabled by setting the spring.jpa.hibernate.ddl-auto property in application.properties. This property can have values like create, create-drop, update, etc.
❮ Previous Set Next Set ❯
Comments
Post a Comment
Leave Comment