Spring Boot Actuator is a powerful set of production-ready features that assist developers in monitoring and managing their applications. Here, we present a set of MCQ questions to test your knowledge of Spring Boot Actuator. Note that each question is followed by the correct answer and an explanation to help reinforce your knowledge.
1. Which Spring Boot starter dependency is required to enable Actuator features?
a) spring-boot-starter-web
b) spring-boot-starter-actuator
c) spring-boot-starter-monitor
d) spring-boot-starter-info
Answer:
b) spring-boot-starter-actuator
Explanation:
The spring-boot-starter-actuator dependency adds all the required libraries to enable Actuator's functionalities.
2. Which Actuator endpoint provides metrics related to memory, garbage collection, and threads?
a) /info
b) /health
c) /metrics
d) /env
Answer:
c) /metrics
Explanation:
The /metrics endpoint provides details about various application metrics including memory, GC, and threads.
3. Which Actuator endpoint displays application environment properties?
a) /details
b) /config
c) /env
d) /properties
Answer:
c) /env
Explanation:
The /env endpoint provides details about the application's environment properties.
4. By default, which Actuator endpoints are available over the web?
a) All of them
b) None of them
c) Only /info and /health
d) Only /metrics
Answer:
c) Only /info and /health
Explanation:
For security reasons, only the /info and /health endpoints are exposed over the web by default.
5. How can you include all Actuator endpoints to be exposed over the web?
a) management.endpoints.web.exposure.include=*
b) management.endpoints.web.exposed=*
c) management.endpoints.web.all=true
d) management.endpoints.web.include.all=true
Answer:
a) management.endpoints.web.exposure.include=*
Explanation:
The property management.endpoints.web.exposure.include=* allows all endpoints to be exposed over the web.
6. Which endpoint helps in accessing the current state of the application's loggers?
a) /logs
b) /loggers
c) /logging
d) /trace
Answer:
b) /loggers
Explanation:
The /loggers endpoint provides access to the application's loggers and allows modifications to their configurations.
7. What does the /health endpoint indicate if the application context failed to start?
a) UP
b) DOWN
c) OUT_OF_SERVICE
d) UNKNOWN
Answer:
b) DOWN
Explanation:
The /health endpoint would return a status of DOWN if the application context failed to start.
8. To change the default path prefix of actuator endpoints from /actuator, which property would you set?
a) management.endpoint.path
b) management.endpoints.prefix
c) management.endpoints.web.base-path
d) management.endpoint.base-path
Answer:
c) management.endpoints.web.base-path
Explanation:
The management.endpoints.web.base-path property can be used to set a different path prefix.
9. Which endpoint provides a history of recent HTTP requests?
a) /trace
b) /history
c) /requests
d) /http-trace
Answer:
d) /http-trace
Explanation:
The /http-trace endpoint provides a trace of recent HTTP requests.
10. How can you secure Actuator endpoints?
a) Using Basic Authentication
b) Using OAuth
c) Using JWT
d) All of the above
Answer:
d) All of the above
Explanation:
Actuator endpoints can be secured using various methods like Basic Authentication, OAuth, JWT, and more.
11. Which Actuator endpoint provides details about the application’s build version, description, and custom metadata?
a) /details
b) /info
c) /meta
d) /version
Answer:
b) /info
Explanation:
The /info endpoint provides details about application metadata including build version, description, and custom attributes.
12. Which of the following is NOT an out-of-the-box status provided by the /health endpoint?
a) UP
b) DOWN
c) HALTED
d) OUT_OF_SERVICE
Answer:
c) HALTED
Explanation:
HALTED is not an out-of-the-box status provided by the /health endpoint. The others, such as UP, DOWN, and OUT_OF_SERVICE, are default statuses.
Comments
Post a Comment
Leave Comment