QuizzesAnnotations — Concept Check
intermediate
java

Annotations — Concept Check

Questions on Annotations. Annotations add metadata to Java code elements, enabling frameworks like Spring, JPA, and JUnit to configure behaviour declaratively.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Annotations — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer uses @Override on a method that doesn't exist in the superclass. What happens?

    • ACompile-time error occurs
    • BThe annotation is removed
    • CRuntime error occurs
    • DThe method is ignored
  2. 2.A team uses @Deprecated on a method without specifying 'since' or 'forRemoval'. What is the effect?

    • AMethod is removed at compile time
    • BIDE warns the method is obsolete
    • CNo effect without 'since' or 'forRemoval'
    • DMethod cannot be used
  3. 3.A developer uses @SuppressWarnings("unchecked") in their code. What is the purpose?

    • ATo mark code for future removal
    • BTo ignore all compiler warnings
    • CTo prevent runtime exceptions
    • DTo silence unchecked cast warnings
  4. 4.A developer defines a @FunctionalInterface with two abstract methods. What is the outcome?

    • ASecond method is ignored
    • BInterface works normally
    • CRuntime exception
    • DCompile-time error
  5. 5.A method is annotated with @RateLimit(requestsPerMinute = 10). What does this imply?

    • AThe method is deprecated
    • BThe method is limited to 10 requests per minute
    • CThe method is overridden
    • DThe method is suppressed from warnings
  6. 6.A developer assumes @Retention(RetentionPolicy.CLASS) makes annotations available at runtime. What is the truth?

    • AAnnotations are documented in Javadoc
    • BAnnotations are not available at runtime
    • CAnnotations are repeatable
    • DAnnotations are available via reflection
  7. 7.What happens if @Documented is used with an annotation?

    • AAnnotation appears in Javadoc
    • BAnnotation can be repeated
    • CAnnotation is available at runtime
    • DAnnotation is removed at compile time
  8. 8.A developer uses reflection to read a method's @RateLimit annotation. What can they access?

    • ArequestsPerMinute and message values
    • BThe method's parameters
    • CThe method's return type
    • DThe method's exceptions