Sun Java Solaris Communities My SDN Account Join SDN
 
AspectJ in Action

Quiz: AspectJ in Action: Practical Aspect-Oriented Programming

 

Quizzes Index


Duke

This quiz is based on Chapters 3, "AspectJ: Syntax Basics" and 10, "Authentication and Authorization," of the book AspectJ in Action: Practical Aspect-Oriented Programming published by Manning Publications Company. Test your knowledge of AspectJ.

Choose the best answer(s) for each question, then click Submit to see how you scored.

 

  1. AspectJ is:
     A. a new web applications framework.
     B. a new XML-based framework to support AOP.
     C. an extension to the Java language to support AOP.
     D. a brand new programming language that supports AOP.

  2. Which of the following statements is false? AspectJ allows capturing join points corresponding to:
     A. method call and execution join points.
     B. read and write access to data member of a class.
     C. execution of exception handler block.
     D. for and while loops.

  3. Which of the statements about pointcut is false?
     A. Pointcut is an AspectJ construct to capture join points.
     B. Pointcuts can be declared inside aspects, classes, and interfaces.
     C. Pointcuts can be declared inside methods.
     D. Pointcuts can have an access specifier.

  4. Which of the following wildcards is not available in AspectJ?
     A. ?
     B. *
     C. +
     D. ..

  5. Binary operators (&& and ||) are used to combine
     A. two aspect (to crosscut the same part of the system).
     B. two pointcuts (to create complex join point matching from simpler pointcuts).
     C. two advice (to determine their composition).
     C. two compile-time declarations.

  6. Which of the following is the correct syntax to capture calls to all methods of the Account class and its subclasses?
     A. call(* Account+.*(..))
     B. call(* Account+.*(*))
     C. call(* Account+.())
     D. call(* Account*.*(..))

  7. AspectJ's dynamic crosscutting does not provide the following kind of advice
     A. Concurrent
     B. Before
     C. After
     C. Around

  8. proceed() used in around advice
     A. Is a special AspectJ keyword to execute the advised join point.
     B. May be called multiple times.
     C. May be called with different parameters than those to the captured join point.
     D. All of the above.

  9. Which of the following statements is false? In AspectJ, you can capture context at join points using these pointcuts
     A. target()
     B. handler()
     C. this()
     D. args()

  10. An around() advice
     A. must declare to return a value.
     B. may choose to execute the captured join point zero or more times.
     C. may execute join point with different arguments than those to the captured join point.
     D. all of the above

  11. The cflow() and cflowbelow() pointcuts are used to capture join points based on
     A. program's control-flow.
     B. method's access control specification.
     C. source file's version control status.
     D. none of the above.

  12. The within() and withincode() pointcuts are used to capture
     A. Join points occurring in the lexical scope of the specified types or methods.
     B. Join points in the control-flow of a join point.
     C. Within the files checked out by the current user.
     D. Within the code marked by special XDoclet tags.

  13. Which of the following statements is correct?
     A. after() returning advice may capture the return value of advised join points.
     B. after() throwing advice may capture the exception thrown by advised join points.
     C. after() advice (without returning or throwing) cannot capture return value or exception thrown.
     D. All of the above.

  14. With AspectJ's "introduction" mechanism, you can:
     A. Add methods with implementation to interfaces.
     B. Add new fields in interfaces.
     C. Add a new parent type to an existing type.
     D. All of the above.

  15. The declare warning and declare error constructs allow
     A. Producing runtime warnings and errors for illegal syntax.
     B. Producing programmable compile-time warnings and errors.
     C. Producing compile-time warnings and errors for illegal syntax.
     D. Producing programmable runtime warnings and errors.