Sample questions
Question 1Easy
Spring Boot Actuator mainly provides:
- A front-end framework
- A GUI builder
- Monitoring endpoints
- A database ORM
Answer: C. Monitoring endpoints
Explanation
Actuator exposes operational information for monitoring and management.
Step-by-step solution
- Actuator adds production-ready features to an app.
- It exposes endpoints such as health and metrics.
- These endpoints help monitor and manage the application.
- So Actuator provides monitoring endpoints.
Why the other options are wrong
- A. Front-end frameworks are not part of Actuator.
- B. A GUI builder is not part of Actuator.
- D. An ORM is a separate library, not Actuator.
Tip: Actuator = health, metrics and info endpoints for operations.
Question 2Easy
What is the default HTTP port of a Spring Boot web application?
- 443
- 8080
- 8000
- 80
Answer: B. 8080
Explanation
Change it with server.port.
Step-by-step solution
- Spring Boot's embedded server listens on port 8080 by default.
- The port is set with server.port.
- 443, 8000 and 80 are not the default here.
- So the answer is 8080.
Why the other options are wrong
- A. 443 is the default for HTTPS, not Spring Boot's default.
- C. 8000 is not the Spring Boot default.
- D. 80 is the default for plain HTTP, not Spring Boot's default.
Tip: Spring Boot default port = 8080. Change with server.port.
Question 3Easy
Which embedded server does spring-boot-starter-web use by default?
- Netty
- Undertow
- Jetty
- Tomcat
Answer: D. Tomcat
Explanation
Tomcat is the default; others can be swapped by excluding it and adding a different starter.
Step-by-step solution
- Spring-boot-starter-web includes an embedded server.
- The default embedded server is Tomcat.
- Other servers can be used by excluding Tomcat and adding another starter.
- So the default is Tomcat.
Why the other options are wrong
- A. Netty is used by WebFlux by default, not the web starter.
- B. Undertow is an option that must be chosen.
- C. Jetty is an option that must be chosen.
Tip: Spring Boot web defaults to Tomcat; swap it by excluding it.
Question 4Easy
spring-boot-devtools is mainly used for:
- Load balancing
- Production security
- Dev-time restarts
- Database migrations
Answer: C. Dev-time restarts
Explanation
DevTools restarts the app when classpath files change and disables some caches in development.
Step-by-step solution
- DevTools is a development-time module.
- It restarts the app when classpath files change.
- It also disables some caches while developing.
- So DevTools is used for dev-time restarts.
Why the other options are wrong
- A. Load balancing is not a DevTools feature.
- B. DevTools is for development, not production security.
- D. Database migrations are handled by other tools such as Flyway.
Tip: DevTools is for development only; it is not used in production.
Question 5Medium
Spring Boot auto-configuration works by:
- Conditional configuration
- Generating source code at compile time
- Downloading config from the internet
- Reading a mandatory XML file
Answer: A. Conditional configuration
Explanation
Auto-configuration classes use conditions such as @ConditionalOnClass and @ConditionalOnMissingBean.
Step-by-step solution
- Auto-configuration classes are part of the Spring Boot jars.
- Each is applied only when certain conditions hold.
- Conditions include @ConditionalOnClass and @ConditionalOnMissingBean.
- So auto-configuration works by conditional configuration.
Why the other options are wrong
- B. Source code is not generated at compile time.
- C. Config is not downloaded from the internet.
- D. No mandatory XML file is read.
Tip: Auto-configuration = configuration applied when conditions match.
Question 6Medium
What does SpringApplication.run(App.class, args) do?
- Runs unit tests
- Compiles the code
- Creates database tables only
- Starts the app
Answer: D. Starts the app
Explanation
It creates the ApplicationContext, applies auto-configuration and starts the web server if present.
Step-by-step solution
- SpringApplication.run starts the Spring application.
- It creates the ApplicationContext and applies auto-configuration.
- It then starts the embedded web server if one is present.
- So it starts the app.
Why the other options are wrong
- A. Unit tests are run by a test framework, not this call.
- B. Compiling is done by the build tool.
- C. Creating tables is not the job of this call.
Tip: SpringApplication.run = start the context and the app.
Question 7Medium
Which connection pool does Spring Boot use by default with JDBC/JPA starters?
- C3P0
- HikariCP
- No pooling
- DBCP 1
Answer: B. HikariCP
Explanation
HikariCP is the preferred default pool when on the classpath.
Step-by-step solution
- Spring Boot's JDBC and JPA starters bring in a connection pool.
- The default pool on the classpath is HikariCP.
- C3P0 and DBCP 1 are other pools, and no pooling is not the default.
- So the answer is HikariCP.
Why the other options are wrong
- A. C3P0 is not the default pool in Spring Boot.
- C. Spring Boot does pool connections by default with HikariCP.
- D. DBCP 1 is not the default.
Tip: Spring Boot uses HikariCP by default when it is on the classpath.
Question 8Medium
By default, which JSON library does Spring Boot's web starter use to convert objects to JSON?
- JSON-B only
- Jackson
- org.json
- Gson
Answer: B. Jackson
Explanation
Jackson's ObjectMapper is auto-configured.
Step-by-step solution
- spring-boot-starter-web includes spring-boot-starter-json.
- That brings in Jackson.
- An ObjectMapper is auto-configured.
Why the other options are wrong
- A. JSON-B is not the default.
- C. org.json is not used by Boot.
- D. Gson is supported but must be added and selected.
Question 9Hard
In Spring Boot 3, where are auto-configuration classes registered?
- META-INF/spring.factories under EnableAutoConfiguration
- WEB-INF/web.xml as listener entries
- application.properties under spring.autoconfigure
- META-INF/spring/...AutoConfiguration.imports
Answer: D. META-INF/spring/...AutoConfiguration.imports
Explanation
Boot 3 reads auto-configurations from META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports; spring.factories is no longer used for them.
Step-by-step solution
- Spring Boot 3 reads auto-configuration names from a file in META-INF/spring.
- The file is named ...AutoConfiguration.imports.
- spring.factories is no longer used for this in Boot 3.
- So the answer is the AutoConfiguration.imports file.
Why the other options are wrong
- A. spring.factories is the older registration method.
- B. web.xml is a Servlet file and does not register auto-configurations.
- C. application.properties sets values, not the auto-configuration list.
Tip: Boot 3: auto-configurations are listed in META-INF/spring/...AutoConfiguration.imports.
Question 10Hard
In a default Spring Boot 3 app with Actuator added, which endpoint is exposed over HTTP without extra configuration?
- /actuator/heapdump
- /actuator/env
- /actuator/beans
- /actuator/health
Answer: D. /actuator/health
Explanation
Only health is exposed over the web by default; others need management.endpoints.web.exposure.include.
Step-by-step solution
- Boot 3 exposes only a few endpoints by default.
- Over HTTP only /actuator/health is exposed.
- Others need management.endpoints.web.exposure.include.
Why the other options are wrong
- A. Heapdump is sensitive and hidden.
- B. Env may leak secrets, hidden.
- C. Beans is hidden by default.
Practise all 18 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →