TCS WINGS 1 T4 SPRING BOOT SET 1

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 you typically use?
    Options:
    A) Hibernate Validator
    B) JSR 303/JSR 380
    C) Both A and B
    D) Spring does not support validation
    Answer:
    C) Both A and B

  • You want to create a RESTful web service that supports JSON and XML. Which content negotiation method should you use?
    Options:
    A) Use @Produces and @Consumes annotations
    B) Configure MessageConverters
    C) Spring Boot supports both formats by default
    D) Both B and C
    Answer:
    D) Both B and C

  • You want to automatically inject a repository into your service class in Spring Boot. What annotation would you use?
    Options:
    A) @Inject
    B) @Autowired
    C) @Resource
    D) @Component
    Answer:
    B) @Autowired

  • To enable CORS in a Spring Boot application, what approach can you take?
    Options:
    A) Use @CrossOrigin on the controller
    B) Configure a global CORS configuration
    C) Both A and B
    D) CORS is handled automatically
    Answer:
    C) Both A and B

  • In Spring Boot, which property would you use to set the server port?
    Options:
    A) server.port
    B) spring.server.port
    C) application.port
    D) server.servlet.port
    Answer:
    A) server.port

  • You want to run a scheduled task in a Spring Boot application. Which annotation would you use?
    Options:
    A) @Scheduled
    B) @EnableScheduling
    C) Both A and B
    D) @Async
    Answer:
    C) Both A and B

Comments

Popular posts from this blog

T4 Spring boot wings 1

TCS WINGS 1 T4 SPRING BOOT SET 10

TCS WINGS 1 T4 SPRING BOOT SET 4