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 aboveIn a Spring Boot application, which annotation is used to define a configuration class?
Options:
A) @SpringBootApplication
B) @Configuration
C) @EnableAutoConfiguration
D) @Component
Answer:
B) @ConfigurationYou 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 StarterIn 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 aboveYou 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 BYou 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 CYou 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) @AutowiredTo 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 BIn 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.portYou 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
Post a Comment