Posts

TCS WINGS 1 T4 SPRING BOOT SET 3

Image
  Rahul Vijayan Follow for more updates TCS WINGS 1 T4 SPRING BOOT SET 3 You want to secure your Spring Boot REST API using OAuth2. Which dependency would you add? Options: A) Spring Security OAuth2 B) Spring Security C) Spring Boot Starter Web D) Spring Cloud Config Answer: A) Spring Security OAuth2 You need to define a custom filter in your Spring Boot application. What class would you extend? Options: A) GenericFilterBean B) OncePerRequestFilter C) Filter D) Both A and B Answer: D) Both A and B In a Spring Boot application, how can you externalize configuration properties? Options: A) Using application.properties B) Using application.yml C) Using environment variables D) All of the above Answer: D) All of the above You want to validate that a String field is not empty in your entity class. What annotation would you use? Options: A) @NotEmpty B) @NotNull C) @Size(min = 1) D) All of the above Answer: D) All of the above You need to prevent the same method from being called multipl...

TCS WINGS 1 T4 SPRING BOOT - SET 2

Image
Rahul Vijayan Follow for more updates TCS WINGS 1 T4 SPRING BOOT - SET 2 What is the default port on which a Spring Boot application runs? Options: A) 8080 B) 8000 C) 80 D) 8888 Answer: A) 8080 You want to implement role-based access control in your Spring Boot application. Which annotation would you use? Options: A) @RolesAllowed B) @PreAuthorize C) @Secured D) All of the above Answer: D) All of the above In a Spring Boot microservices architecture, which component is responsible for service discovery? Options: A) Eureka B) Zuul C) Ribbon D) Spring Cloud Config Answer: A) Eureka You want to create a custom exception in your Spring Boot application. What should you extend? Options: A) Exception B) RuntimeException C) Throwable D) Both A and B Answer: B) RuntimeException You need to handle global exceptions in a Spring Boot REST API. Which class should you use? Options: A) @ControllerAdvice B) ResponseEntityExceptionHandler C) @RestController D) Both A and B Answer: D) Both A and B You ...

TCS WINGS 1 T4 SPRING BOOT SET 1

Image
Rahul Vijayan Follow for more updates TCS WINGS 1 T4 SPRING BOOT SET 1 You need to expose a REST API using Spring Boot. Which annotation do you use on your controller method? Options: A) @GetMapping B) @RequestMapping C) @PostMapping D) All of the above Answer: D) All of the above In a Spring Boot application, which annotation is used to define a configuration class? Options: A) @SpringBootApplication B) @Configuration C) @EnableAutoConfiguration D) @Component Answer: B) @Configuration You want to secure your Spring Boot application with basic authentication. Which dependency would you include? Options: A) Spring Security Starter B) Spring Boot Starter Web C) Spring Boot Starter Actuator D) Spring Boot Starter Data JPA Answer: A) Spring Security Starter In Spring Boot, which annotation is used to create a bean? Options: A) @Bean B) @Component C) @Service D) All of the above Answer: D) All of the above You want to validate user inputs in your Spring Boot application. Which library would...

T4 Spring boot wings 1

Spring Boot MCQ 1. Spring Boot Annotations MCQs Annotations simplify development by reducing the need for configuration. The questions in this section revolve around various Spring Boot annotations and their usage in real-world applications. ### 1. **What is the purpose of `@SpringBootApplication` in a Spring Boot application?** - A) It enables Spring Security. - B) It marks the main class for auto-configuration, component scanning, and configuration properties. - C) It disables embedded server. - D) It configures Hibernate. **Answer:** B) It marks the main class for auto-configuration, component scanning, and configuration properties. ### 2. **Which annotation is used to define a Spring-managed bean?** - A) `@Component` - B) `@Service` - C) `@Bean` - D) All of the above **Answer:** D) All of the above ### 3. **Which annotation is used to inject dependencies in Spring Boot?** - A) `@Autowired` - B) `@Inject` - C) `@Resource` - D) ...