TCS WINGS 1 T4 SPRING BOOT SET 4
Rahul Vijayan
Follow for more updates
TCS WINGS 1 T4 SPRING BOOT SET 4
You want to configure a custom error page in your Spring Boot application. What file should you create?
Options:
A) error.html in resources/templates
B) error.json in resources
C) error.jsp in webapp
D) error.xml in resources
Answer:
A) error.html in resources/templatesYou need to implement pagination in your Spring Data JPA repository. What method would you use?
Options:
A) findAll(Pageable pageable)
B) findAll(Sort sort)
C) findAll()
D) find(PageRequest pageRequest)
Answer:
A) findAll(Pageable pageable)You want to retrieve the current user from Spring Security's context. What would you do?
Options:
A) SecurityContextHolder.getContext().getAuthentication().getPrincipal()
B) @AuthenticationPrincipal
C) Both A and B
D) Spring Security does not provide user details
Answer:
C) Both A and BYou want to enable HTTPS in your Spring Boot application. What is the first step?
Options:
A) Generate a self-signed certificate
B) Set the server.port property
C) Modify application.yml
D) Enable Spring Security
Answer:
A) Generate a self-signed certificateYou need to allow a user to reset their password in your Spring Boot application. What approach would you take?
Options:
A) Send a reset link via email
B) Provide a direct link to change the password
C) Both A and B
D) Spring Security does not support password resets
Answer:
C) Both A and BYou want to implement a custom authentication provider in Spring Security. What interface should you implement?
Options:
A) AuthenticationManager
B) UserDetailsService
C) AuthenticationProvider
D) CustomAuthenticator
Answer:
C) AuthenticationProviderYou need to use external configuration files for different environments. What would you use in Spring Boot?
Options:
A) application-{profile}.properties
B) application.yml
C) config-{profile}.properties
D) Both A and B
Answer:
D) Both A and BYou want to implement distributed tracing in your microservices architecture. Which tool would you typically use?
Options:
A) Spring Cloud Sleuth
B) Zipkin
C) Both A and B
D) Distributed tracing is not supported in Spring Boot
Answer:
C) Both A and BYou need to prevent CSRF attacks in your Spring Boot application. What should you do?
Options:
A) Disable CSRF protection
B) Enable CSRF protection in Spring Security
C) Implement your own CSRF mechanism
D) CSRF is not a concern in Spring Boot
Answer:
B) Enable CSRF protection in Spring SecurityYou want to create a custom repository for your Spring Data JPA entity. What should you create?
Options:
A) An interface extending JpaRepository
B) A class implementing RepositorySupport
C) Both A and B
D) Spring Data JPA does not support custom repositories
Answer:
A) An interface extending JpaRepository

Comments
Post a Comment