Loading

Quipoin Menu

Learn • Practice • Grow

spring / Spring Data JPA
mcq
Direction: Choose the correct option

Q1.

What is Spring Data JPA?
A. A Spring module that simplifies JPA-based data access
B. A replacement for JPA
C. An ORM
D. None
Direction: Choose the correct option

Q2.

What is a repository in Spring Data JPA?
A. An interface for CRUD operations on entities
B. A DAO pattern implementation
C. Both A and B
D. None
Direction: Choose the correct option

Q3.

Which interface is the base for CRUD repositories?
A. CrudRepository
B. JpaRepository
C. PagingAndSortingRepository
D. All
Direction: Choose the correct option

Q4.

How do you define a custom query method in a repository?
A. By using method naming conventions (findByLastName)
B. By annotating with @Query
C. Both A and B
D. None
Direction: Choose the correct option

Q5.

What does @Query do?
A. Allows defining custom JPQL or native SQL queries
B. Specifies query name
C. Defines query parameters
D. None
Direction: Choose the correct option

Q6.

How do you enable JPA repositories?
A. @EnableJpaRepositories
B. @EnableJpa
C. @EnableDataJpa
D. @EnableRepositories
Direction: Choose the correct option

Q7.

What is the return type of a finder method that returns multiple results?
A. List<T>
B. Iterable<T>
C. Set<T>
D. All of the above
Direction: Choose the correct option

Q8.

How do you handle pagination in Spring Data JPA?
A. Use Pageable parameter and return Page
B. Use PaginationRequest
C. Use @PageableDefault
D. None
Direction: Choose the correct option

Q9.

What does @Modifying do?
A. Indicates that a query is an update/delete and requires execution within transaction
B. Modifies the query
C. Updates entity
D. None
Direction: Choose the correct option

Q10.

What is the purpose of @Transactional in Spring Data JPA?
A. To manage transaction boundaries
B. To ensure ACID properties
C. To commit or rollback
D. All of the above