Spring Boot - Full MCQ Mock Test (50 Questions)
1. What is the primary purpose of Spring Boot?
A. To build front-end applications
B. To simplify the development of new Spring applications
C. To manage database migrations
D. To build Android apps
Correct Answer: B
2. Which annotation is used to auto-configure a Spring Boot application?
A. @Component
B. @EnableConfiguration
C. @Configuration
D. @EnableAutoConfiguration
Correct Answer: D
3. What does the @SpringBootApplication annotation include?
A. @ComponentScan
B. @EnableAutoConfiguration
C. @SpringBootConfiguration
D. All of the above
Correct Answer: D
4. Which starter is used for building REST APIs in Spring Boot?
A. spring-boot-starter-data-jpa
B. spring-boot-starter-security
C. spring-boot-starter-web
D. spring-boot-starter-thymeleaf
Correct Answer: C
5. Which of the following is a correct dependency for Spring Security in pom.xml?
A. spring-boot-security
B. spring-boot-starter-security
C. spring-starter-security
D. spring-boot-starter-web-security
Correct Answer: B
6. What does the @RestController annotation combine?
A. @Controller + @ResponseBody
B. @Service + @Repository
C. @Component + @Bean
D. @Controller + @RequestParam
Correct Answer: A
7. Which method is used to launch the Spring Boot application?
A. runApp()
B. SpringApp.run()
C. SpringApplication.run()
D. Boot.run()
Correct Answer: C
8. Which annotation is used to inject a bean automatically in Spring Boot?
A. @Inject
B. @Bean
C. @Autowired
D. @Qualifier
Correct Answer: C
9. Which of the following is a REST API HTTP method?
A. FETCH
B. CREATE
C. GET
D. BUILD
Correct Answer: C
10. What is the use of application.properties in Spring Boot?
A. Contains HTML templates
B. Contains CSS styles
C. Holds configuration settings
D. Defines REST endpoints
Correct Answer: C
11. Which layer handles the business logic in Spring Boot Architecture?
A. Presentation Layer
B. Business Layer
C. Persistence Layer
D. Database Layer
Correct Answer: B
12. Which annotation is used to map HTTP GET requests in Spring Boot?
A. @PostMapping
B. @PutMapping
C. @GetMapping
D. @DeleteMapping
Correct Answer: C
13. What is the use of @ComponentScan annotation?
A. To define REST endpoints
B. To configure Spring Boot
C. To specify base packages to scan for beans
D. None of the above
Correct Answer: C
14. Which of the following HTTP methods is used to update a resource?
A. GET
B. POST
C. PUT
D. DELETE
Correct Answer: C
15. Which annotation is used to bind request parameters to a method parameter?
A. @RequestParam
B. @PathVariable
C. @Autowired
D. @ResponseBody
Correct Answer: A
16. Which file is used to manage project dependencies in Spring Boot (Maven)?
A. settings.xml
B. build.gradle
C. pom.xml
D. application.yml
Correct Answer: C
17. Which Spring Boot annotation is used to create RESTful web services?
A. @RestService
B. @RestController
C. @WebService
D. @RestApi
Correct Answer: B
18. What is the default embedded server in Spring Boot?
A. Jetty
B. Undertow
C. Tomcat
D. Netty
Correct Answer: C
19. Which annotation is used to map HTTP DELETE requests in Spring Boot?
A. @DeleteRequest
B. @RemoveMapping
C. @DeleteMapping
D. @RemoveRequest
Correct Answer: C
20. Which file is used to define Spring Boot configurations?
A. config.properties
B. application.properties
C. settings.json
D. app.yml
Correct Answer: B