Loading

Quipoin Menu

Learn • Practice • Grow

spring / Example Project for AOP
mcq
Direction: Choose the correct option

Q1.

In a typical AOP example project, what is commonly used as a cross-cutting concern?
A. Logging
B. Performance monitoring
C. Security
D. All of the above
Direction: Choose the correct option

Q2.

How do you enable AOP in a Spring Boot project?
A. Add spring-boot-starter-aop dependency
B. Use @EnableAspectJAutoProxy
C. Both A and B
D. None
Direction: Choose the correct option

Q3.

What annotation is used to declare an aspect class?
A. @Aspect
B. @Component
C. @Service
D. @AspectJ
Direction: Choose the correct option

Q4.

In an AOP example, what is a typical pointcut expression to log all methods in a package?
A. execution(* com.example.service.*.*(..))
B. within(com.example.service.*)
C. both A and B
D. None
Direction: Choose the correct option

Q5.

What does the following pointcut match? execution(* com..*.*(..))
A. Any method in any class under com package
B. Only public methods
C. Only void methods
D. None
Direction: Choose the correct option

Q6.

In a logging aspect, which advice is commonly used to log method entry?
A. @Before
B. @After
C. @Around
D. @AfterReturning
Direction: Choose the correct option

Q7.

How do you log method execution time in AOP?
A. Using @Around advice to capture start and end time
B. Using @Before and @After separately
C. Both A and B
D. None
Direction: Choose the correct option

Q8.

What is required to make an aspect work in Spring?
A. The aspect must be a Spring bean (e.g., @Component)
B. The aspect must be registered in XML
C. Both A and B
D. None
Direction: Choose the correct option

Q9.

In an AOP example, what does the proceed() method do?
A. Executes the target method
B. Returns the aspect
C. Stops execution
D. None
Direction: Choose the correct option

Q10.

What is a common use case for AOP in real projects?
A. Transaction management
B. Security checks
C. Caching
D. All of the above