adplus-dvertising

Welcome to the AspectJ and Scripting in Spring MCQs Page

Dive deep into the fascinating world of AspectJ and Scripting in Spring with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of AspectJ and Scripting in Spring, a crucial aspect of Java Spring Framework. In this section, you will encounter a diverse range of MCQs that cover various aspects of AspectJ and Scripting in Spring, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Spring Framework.

frame-decoration

Check out the MCQs below to embark on an enriching journey through AspectJ and Scripting in Spring. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Spring Framework.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of AspectJ and Scripting in Spring. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

AspectJ and Scripting in Spring MCQs | Page 2 of 8

Explore more Topics under Java Spring Framework

Q11.
What will be the output of the code snippet?
    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.AfterThrowing;
 
    @Aspect
    public class AfterThrowingExample 
    {
 
	  @AfterThrowing(
	    pointcut="com.xyz.myapp.SystemArchitecture.dataAccessOperation()",
	    throwing="ex")
	  public void doRecoveryActions(DataAccessException e)
          {
		throw new IllegalArgumentException();
	    // ...[/expand]
	  }
 
    }
Discuss
Answer: (c).BeanCreation Exception
Q12.
Which instantiation model is supported by AspectJ?
Discuss
Answer: (d).all of the mentioned
Q13.
Which tag in XML is used to declare @Before advice’s method?
Discuss
Answer: (a).aop:before
Q14.
PointCut definitions can’t be reused again
Discuss
Answer: (b).False
Q15.
Annotation used to refer poincuts?
Discuss
Answer: (a).@Pointcut
Q16.
What will be the output of the code snippet?
package com.apress.springrecipes.calculator;
   import org.aspectj.lang.annotation.Aspect;
   import org.aspectj.lang.annotation.Pointcut;
   @Aspect
   public class CalculatorPointcuts 
   {
 @Pointcut("execution(* *.*(..))")
 public void loggingOperation() {}
   }
 
   package com.apress.springrecipes.calculator;
   @Aspect
public class CalculatorLoggingAspect 
{
   ...
   @Before("CalculatorPointcuts.loggingOperation()")
   public void logBefore(JoinPoint joinPoint) 
   {
   ...
   }
   @AfterReturning(
   pointcut = "loggingOperation()",
   returning = "result")
   public void logAfterReturning(JoinPoint joinPoint, Object result)
   {
   throw new IllegalArgumentException();
   }
   @AfterThrowing(
   pointcut = "CalculatorPointcuts.loggingOperation()",
   throwing = "e")
   public void logAfterThrowing(JoinPoint joinPoint, IllegalArgumentException e)
   {
   ...
   }
   @Around("CalculatorPointcuts.loggingOperation()")
   public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable 
   {
   ...
   }
}
Discuss
Answer: (c).BeanCreation Exception
Discuss
Answer: (a).AspectJ pointcut language
Q18.
Spring AOP only supports method execution join points for the beans in its IoC container
Discuss
Answer: (a).True
Q19.
Is the following pointcut expression correct?

execution(* ArithmeticCalculator.*(..))
Discuss
Answer: (c).If every target class is in same package
Q20.
The annotations must be added to the implementation class but not the interface
Discuss
Answer: (a).True
Page 2 of 8

Suggested Topics

Are you eager to expand your knowledge beyond Java Spring Framework? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!