A company needs to perform scheduled tasks in a Spring application. What should they use?
A@Scheduled annotation
B@Controller
C@Service
D@Configuration
Explanation
@Scheduled annotation is designed for scheduling tasks, unlike the other annotations which serve specific roles in the application context.
Q42
You are configuring a Spring Boot application. What happens when you enable 'spring.main.allow-bean-definition-overriding'?
AAllows duplicate bean definitions
BDisables Spring context loading
CIncreases application startup time
DFilters components during scanning
Explanation
'spring.main.allow-bean-definition-overriding' allows duplicate beans, while the others do not address bean definitions directly.
Q43
Which service allows you to manage application configurations in Spring?
ASpring Cloud Config
BSpring Data
CSpring Boot Actuator
DSpring Security
Explanation
Spring Cloud Config provides server-side and client-side support for externalized configuration in distributed systems.
Q44
A company needs to monitor the health of its microservices in a Spring application. What should they use?
ASpring Boot Actuator
BSpring MVC
CSpring Security
DSpring AOP
Explanation
Spring Boot Actuator exposes endpoints for monitoring and managing Spring applications, including health checks.
Q45
You are configuring a Spring Boot application with a database. What happens when the datasource URL is incorrect?
AApplication starts normally
BApplication fails to start
CDatabase connections work intermittently
DApplication runs in memory mode
Explanation
An incorrect datasource URL will cause the application to fail on startup due to connection issues.
Q46
Which service allows for building microservices?
ASpring Cloud
BSpring Boot
CSpring Data
DSpring MVC
Explanation
Spring Cloud facilitates building microservices; the others serve different purposes.
Q47
A company needs to handle multiple data sources efficiently. What should they use?
ASpring Batch
BSpring Data JPA
CSpring Security
DSpring WebFlux
Explanation
Spring Data JPA is suitable for managing multiple data sources versus other options.
Q48
You are configuring Spring Security. What happens when you set CSRF protection as disabled?
AIncreased security risk
BImproved performance only
CNo changes to security
DReverts to default settings
Explanation
Disabling CSRF protection increases security risk, while other options misrepresent its effects.
Q49
Which service allows you to manage application lifecycle in Kubernetes?
ASpring Cloud Kubernetes
BSpring Data JPA
CSpring Batch
DSpring Security
Explanation
Spring Cloud Kubernetes integrates Kubernetes with Spring applications for lifecycle management, while the others focus on data access, batch processing, and security.
Q50
A company needs to decouple their microservices for better scalability. What should they implement?
AMonolithic architecture
BSynchronous API calls
CAsynchronous communication
DDirect database access
Explanation
Asynchronous communication effectively decouples services, while the others create tight coupling.