Objective Assessment Review
(Questions & Solutions)
2025
©2025
, Question 1
A large enterprise is transitioning its monolithic application into a
microservices architecture using Spring Boot. To centralize external
configurations for multiple environments, which Spring Cloud component
is most appropriate?
A. Spring Cloud Config
B. Spring Boot Actuator
C. Spring Cloud Bus
D. Netflix Hystrix
ANS: A
Rationale: Spring Cloud Config provides a centralized configuration
management system that externalizes properties and enables runtime
updates across microservices, a key benefit in distributed systems.
---
Question 2
In a secured Java web application using Spring Security, what is the
primary advantage of applying method-level security annotations (e.g.,
@PreAuthorize) instead of URL-based security only?
A. They allow cross–domain requests by default.
B. They enable fine-grained access control at the business method level.
C. They reduce the overhead of session management.
D. They simplify the configuration of Spring MVC controllers.
ANS: B
Rationale: Using annotations like @PreAuthorize directly at the method
level allows for concise, role-based access control for business logic,
enhancing security granularity.
---
Question 3
When using Hibernate as the ORM layer, what is the primary role of the
©2025
,SessionFactory?
A. It establishes a connection pool for JDBC.
B. It creates Session objects that manage database operations.
C. It provides caching for entity objects automatically.
D. It converts HQL queries into SQL at runtime.
ANS: B
Rationale: The SessionFactory is a thread‑safe, heavyweight object that
creates Sessions. These Session objects act as a gateway for CRUD
operations and manage object states with the database.
---
Question 4
In the Spring Framework, Aspect-Oriented Programming (AOP) is used
primarily to:
A. Simplify the configuration of BeanFactory.
B. Modularize cross-cutting concerns (e.g., logging, security, transaction
management).
C. Automatically generate RESTful endpoints.
D. Enhance session management by intercepting HTTP requests.
ANS: B
Rationale: AOP enables the separation of cross‑cutting concerns from
business logic, thereby reducing code duplication and enhancing
maintainability.
---
Question 5
What is the main benefit of Spring Boot's auto-configuration feature?
A. It completely eliminates manual configuration in every scenario.
B. It automatically instantiates beans based on classpath settings and
defined properties.
C. It forces developers to follow strict coding conventions.
D. It provides a fully reactive programming model out-of-the-box.
ANS: B
©2025
, Rationale: Auto‑configuration in Spring Boot examines the application’s
classpath and properties to automatically set up beans and
infrastructure, significantly reducing boilerplate code while still allowing
customization.
---
Question 6
A development team is building a reactive microservices application
using Spring WebFlux. Which publisher type best represents a stream of
multiple asynchronous items?
A. Mono
B. Flux
C. Single
D. Observable
ANS: B
Rationale: In Spring WebFlux, a Flux represents an asynchronous
sequence of 0 to many items and is central to reactive programming,
while a Mono represents either zero or one item.
---
Question 7
A web application built on Struts2 separates user actions from business
logic using a specific design pattern. Which pattern is primarily used by
Struts2?
A. Observer
B. Front Controller
C. Singleton
D. Template Method
ANS: B
Rationale: Struts2 employs the Front Controller pattern (via its
ActionServlet) to centralize request handling and delegate control to
appropriate action classes, thereby decoupling the UI from the business
logic.
©2025