Practice API annotation vocabulary: @deprecated, @throws, @since, @version, @see, and OpenAPI annotations like @ApiOperation and @Schema.
0 / 25 completed
1 / 25
A Java method is annotated with `@Deprecated`. What does this annotation signal to other developers?
@Deprecated marks an API element as outdated. IDEs show a strikethrough and generate warnings when it's used. The convention is to also add a Javadoc comment explaining the replacement. Using deprecated APIs means your code will eventually break.
2 / 25
A method's Javadoc includes `@throws IllegalArgumentException if the input is null`. What does this tag communicate?
The @throws tag (or @exception) documents the exceptions a method can throw and the conditions that trigger them. This is critical API contract information — callers must decide whether to catch the exception, validate input first, or let it propagate.
3 / 25
An API method has `@since 2.3.0` in its documentation. What does this tell you?
@since documents which version of the API first introduced a method or class. This helps developers determine whether their target platform/library version includes the feature, and it documents the API's evolution history.
4 / 25
A Spring Boot controller method uses `@ApiOperation(value = 'Get user by ID', notes = 'Returns a single user object')`. What framework does this annotation come from?
@ApiOperation is a Springfox/Swagger annotation (or its Springdoc equivalent @Operation) that enriches the generated OpenAPI documentation. The `value` provides a short summary and `notes` adds a longer description visible in the Swagger UI.
5 / 25
An OpenAPI schema class has `@Schema(description = 'User email address', example = 'user@example.com', required = true)`. What is the primary benefit of the `example` field?
The `example` field in @Schema populates the generated API documentation with a concrete sample value. This makes the documentation more useful — developers can see a realistic value rather than just a type description, and it appears in 'Try it out' requests in Swagger UI.
6 / 25
Reviewer: 'I'm seeing this `@Payload(value = 'user_id')` annotation on the `getUserById` method. It seems a little vague – could you clarify what data type it's expecting? You: (Responding in a Slack message to your reviewer)
This question focuses on understanding the *intent* of a payload annotation rather than simply knowing its syntax. The `Payload` annotation isn't about rigidly defining data types; instead, it's primarily for documentation and clarity regarding what input is expected. A good developer will recognize that while the parameter name hints at purpose, further detail (like type) should be documented elsewhere – the annotation's role is to *suggest* this, not enforce it.
7 / 25
Reviewer: 'I'm reviewing this PR and noticed the `@Validating(value = 'username')` annotation on the `createUser` method. It's not immediately clear what kind of validation is being performed. Could you elaborate on the expected format for the `username` parameter? You: (Responding in a Slack message to your reviewer) 'Sure thing! The `@Validating` annotation here indicates that we're expecting the `username` parameter to be a string, and it's subject to validation against our username policy which requires it to be between 3 and 32 characters long, and contain only alphanumeric characters.'
This question tests understanding of a specific validation annotation. The `@Validating` annotation doesn't *define* the validation rules; it signals that *some* validation is applied to the parameter. The correct answer highlights that the annotation confirms the presence of the parameter, which is a necessary first step, while the other options misinterpret its purpose – it's not just about specifying the data type or constraints themselves. A good developer would understand this means further investigation into the actual implementation is needed.
8 / 25
Reviewer: 'I'm looking at this API endpoint documentation for the /products/{product_id} method. The `@Parameter(name = 'product_id', description = 'The unique identifier of the product.')` annotation seems a little redundant – isn't that already implied by the URL path? You: (Responding in a Slack message to your reviewer) 'That's a fair point! Let me clarify. While the URL does indicate the product ID, the `@Parameter` annotation here is primarily for improved discoverability and tooling integration. It allows our API gateway and documentation generation tools to consistently map the URL segment to the parameter name, ensuring accurate data binding during request processing.'
This question tests understanding of the *purpose* of annotations beyond simply describing parameters. The `@Parameter` annotation isn't just about repetition; it's a metadata tag used by tools like API gateways and documentation generators to ensure correct data binding. Incorrect options highlight the misconception that annotations only serve a human-readable function or specify data types – which are handled elsewhere (e.g., OpenAPI schema).
9 / 25
Reviewer: 'I'm getting this response from the `/users` endpoint: `HTTP Status: 422 UnprocessableEntity`. The documentation says it should return 200 OK for valid user creation requests. What could be causing this, and what information would you look for in the logs to diagnose the problem?', You: (Responding in a Slack message to your reviewer) 'Okay, let's investigate. This 422 error usually indicates validation issues with the request body. I'd immediately check the API gateway logs for details on the specific validation errors being reported – they often include JSON payloads showing which fields failed validation and why. Specifically, I'd look for messages like 'Invalid email format' or 'Username too long'.'
This question tests understanding of error responses and debugging. The 422 status code signals data validation failures. The key here is recognizing that the problem lies with *what was sent* to the API, not a general server issue or gateway configuration. Examining API gateway logs for specific validation messages (like invalid email formats) is the standard first step in diagnosing such problems. Option A and B are incorrect as they represent broader system issues; option C accurately describes the core problem and how to investigate it.
10 / 25
PR Description:
"Implemented a new API endpoint to update user profiles. Added the `@Updateable(value = 'firstName')` annotation to indicate that this field is mutable via the API."
Reviewer: 'I'm reviewing this PR and noticed the `@Updateable(value = 'firstName')` annotation. It seems a little ambiguous – could you elaborate on *why* `firstName` is specifically marked as updateable, and what other fields might be considered for similar annotations in the future?'
You: (Responding in a Slack message to your reviewer)
This question assesses understanding of the purpose of an `Updateable` annotation. The correct answer emphasizes that it's a signal about *specific* field mutability, not a general rule or prioritization strategy. Incorrect options misinterpret the annotation as dictating exclusive update rights or driving broader API design decisions – the annotation is primarily for developer clarity and potentially tooling integration regarding mutable fields.
11 / 25
Reviewer: 'I'm seeing this `@Payload(value = 'user_id')` annotation on the `getUserById` method. It seems a little vague – could you clarify what data type it's expecting? You: (Responding in a Slack message to your reviewer)
This question focuses on understanding the *intent* of a payload annotation rather than simply knowing its syntax. The `Payload` annotation isn't about rigidly defining data types; instead, it's primarily for documentation and clarity regarding what input is expected. A good developer will recognize that while the parameter name hints at purpose, further detail (like type) should be documented elsewhere – the annotation's role is to *suggest* this, not enforce it.
12 / 25
Reviewer: 'I'm reviewing this PR and noticed the `@Validating(value = 'username')` annotation on the `createUser` method. It's not immediately clear what kind of validation is being performed. Could you elaborate on the expected format for the `username` parameter? You: (Responding in a Slack message to your reviewer) 'Sure thing! The `@Validating` annotation here indicates that we're expecting the `username` parameter to be a string, and it's subject to validation against our username policy which requires it to be between 3 and 32 characters long, and contain only alphanumeric characters.'
This question tests understanding of a specific validation annotation. The `@Validating` annotation doesn't *define* the validation rules; it signals that *some* validation is applied to the parameter. The correct answer highlights that the annotation confirms the presence of the parameter, which is a necessary first step, while the other options misinterpret its purpose – it's not just about specifying the data type or constraints themselves. A good developer would understand this means further investigation into the actual implementation is needed.
13 / 25
Reviewer: 'I'm looking at this API endpoint documentation for the /products/{product_id} method. The `@Parameter(name = 'product_id', description = 'The unique identifier of the product.')` annotation seems a little redundant – isn't that already implied by the URL path? You: (Responding in a Slack message to your reviewer) 'That's a fair point! Let me clarify. While the URL does indicate the product ID, the `@Parameter` annotation here is primarily for improved discoverability and tooling integration. It allows our API gateway and documentation generation tools to consistently map the URL segment to the parameter name, ensuring accurate data binding during request processing.'
This question tests understanding of the *purpose* of annotations beyond simply describing parameters. The `@Parameter` annotation isn't just about repetition; it's a metadata tag used by tools like API gateways and documentation generators to ensure correct data binding. Incorrect options highlight the misconception that annotations only serve a human-readable function or specify data types – which are handled elsewhere (e.g., OpenAPI schema).
14 / 25
Reviewer: 'I'm getting this response from the `/users` endpoint: `HTTP Status: 422 UnprocessableEntity`. The documentation says it should return 200 OK for valid user creation requests. What could be causing this, and what information would you look for in the logs to diagnose the problem?', You: (Responding in a Slack message to your reviewer) 'Okay, let's investigate. This 422 error usually indicates validation issues with the request body. I'd immediately check the API gateway logs for details on the specific validation errors being reported – they often include JSON payloads showing which fields failed validation and why. Specifically, I'd look for messages like 'Invalid email format' or 'Username too long'.'
This question tests understanding of error responses and debugging. The 422 status code signals data validation failures. The key here is recognizing that the problem lies with *what was sent* to the API, not a general server issue or gateway configuration. Examining API gateway logs for specific validation messages (like invalid email formats) is the standard first step in diagnosing such problems. Option A and B are incorrect as they represent broader system issues; option C accurately describes the core problem and how to investigate it.
15 / 25
PR Description:
"Implemented a new API endpoint to update user profiles. Added the `@Updateable(value = 'firstName')` annotation to indicate that this field is mutable via the API."
Reviewer: 'I'm reviewing this PR and noticed the `@Updateable(value = 'firstName')` annotation. It seems a little ambiguous – could you elaborate on *why* `firstName` is specifically marked as updateable, and what other fields might be considered for similar annotations in the future?'
You: (Responding in a Slack message to your reviewer)
This question assesses understanding of the purpose of an `Updateable` annotation. The correct answer emphasizes that it's a signal about *specific* field mutability, not a general rule or prioritization strategy. Incorrect options misinterpret the annotation as dictating exclusive update rights or driving broader API design decisions – the annotation is primarily for developer clarity and potentially tooling integration regarding mutable fields.
16 / 25
Reviewer: 'I'm seeing this `@Payload(value = 'user_id')` annotation on the `getUserById` method. It seems a little vague – could you clarify what data type it's expecting? You: (Responding in a Slack message to your reviewer)
This question focuses on understanding the *intent* of a payload annotation rather than simply knowing its syntax. The `Payload` annotation isn't about rigidly defining data types; instead, it's primarily for documentation and clarity regarding what input is expected. A good developer will recognize that while the parameter name hints at purpose, further detail (like type) should be documented elsewhere – the annotation's role is to *suggest* this, not enforce it.
17 / 25
Reviewer: 'I'm reviewing this PR and noticed the `@Validating(value = 'username')` annotation on the `createUser` method. It's not immediately clear what kind of validation is being performed. Could you elaborate on the expected format for the `username` parameter? You: (Responding in a Slack message to your reviewer) 'Sure thing! The `@Validating` annotation here indicates that we're expecting the `username` parameter to be a string, and it's subject to validation against our username policy which requires it to be between 3 and 32 characters long, and contain only alphanumeric characters.'
This question tests understanding of a specific validation annotation. The `@Validating` annotation doesn't *define* the validation rules; it signals that *some* validation is applied to the parameter. The correct answer highlights that the annotation confirms the presence of the parameter, which is a necessary first step, while the other options misinterpret its purpose – it's not just about specifying the data type or constraints themselves. A good developer would understand this means further investigation into the actual implementation is needed.
18 / 25
Reviewer: 'I'm looking at this API endpoint documentation for the /products/{product_id} method. The `@Parameter(name = 'product_id', description = 'The unique identifier of the product.')` annotation seems a little redundant – isn't that already implied by the URL path? You: (Responding in a Slack message to your reviewer) 'That's a fair point! Let me clarify. While the URL does indicate the product ID, the `@Parameter` annotation here is primarily for improved discoverability and tooling integration. It allows our API gateway and documentation generation tools to consistently map the URL segment to the parameter name, ensuring accurate data binding during request processing.'
This question tests understanding of the *purpose* of annotations beyond simply describing parameters. The `@Parameter` annotation isn't just about repetition; it's a metadata tag used by tools like API gateways and documentation generators to ensure correct data binding. Incorrect options highlight the misconception that annotations only serve a human-readable function or specify data types – which are handled elsewhere (e.g., OpenAPI schema).
19 / 25
Reviewer: 'I'm getting this response from the `/users` endpoint: `HTTP Status: 422 UnprocessableEntity`. The documentation says it should return 200 OK for valid user creation requests. What could be causing this, and what information would you look for in the logs to diagnose the problem?', You: (Responding in a Slack message to your reviewer) 'Okay, let's investigate. This 422 error usually indicates validation issues with the request body. I'd immediately check the API gateway logs for details on the specific validation errors being reported – they often include JSON payloads showing which fields failed validation and why. Specifically, I'd look for messages like 'Invalid email format' or 'Username too long'.'
This question tests understanding of error responses and debugging. The 422 status code signals data validation failures. The key here is recognizing that the problem lies with *what was sent* to the API, not a general server issue or gateway configuration. Examining API gateway logs for specific validation messages (like invalid email formats) is the standard first step in diagnosing such problems. Option A and B are incorrect as they represent broader system issues; option C accurately describes the core problem and how to investigate it.
20 / 25
PR Description:
"Implemented a new API endpoint to update user profiles. Added the `@Updateable(value = 'firstName')` annotation to indicate that this field is mutable via the API."
Reviewer: 'I'm reviewing this PR and noticed the `@Updateable(value = 'firstName')` annotation. It seems a little ambiguous – could you elaborate on *why* `firstName` is specifically marked as updateable, and what other fields might be considered for similar annotations in the future?'
You: (Responding in a Slack message to your reviewer)
This question assesses understanding of the purpose of an `Updateable` annotation. The correct answer emphasizes that it's a signal about *specific* field mutability, not a general rule or prioritization strategy. Incorrect options misinterpret the annotation as dictating exclusive update rights or driving broader API design decisions – the annotation is primarily for developer clarity and potentially tooling integration regarding mutable fields.
21 / 25
Reviewer: 'I'm seeing this `@Payload(value = 'user_id')` annotation on the `getUserById` method. It seems a little vague – could you clarify what data type it's expecting? You: (Responding in a Slack message to your reviewer)
This question focuses on understanding the *intent* of a payload annotation rather than simply knowing its syntax. The `Payload` annotation isn't about rigidly defining data types; instead, it's primarily for documentation and clarity regarding what input is expected. A good developer will recognize that while the parameter name hints at purpose, further detail (like type) should be documented elsewhere – the annotation's role is to *suggest* this, not enforce it.
22 / 25
Reviewer: 'I'm reviewing this PR and noticed the `@Validating(value = 'username')` annotation on the `createUser` method. It's not immediately clear what kind of validation is being performed. Could you elaborate on the expected format for the `username` parameter? You: (Responding in a Slack message to your reviewer) 'Sure thing! The `@Validating` annotation here indicates that we're expecting the `username` parameter to be a string, and it's subject to validation against our username policy which requires it to be between 3 and 32 characters long, and contain only alphanumeric characters.'
This question tests understanding of a specific validation annotation. The `@Validating` annotation doesn't *define* the validation rules; it signals that *some* validation is applied to the parameter. The correct answer highlights that the annotation confirms the presence of the parameter, which is a necessary first step, while the other options misinterpret its purpose – it's not just about specifying the data type or constraints themselves. A good developer would understand this means further investigation into the actual implementation is needed.
23 / 25
Reviewer: 'I'm looking at this API endpoint documentation for the /products/{product_id} method. The `@Parameter(name = 'product_id', description = 'The unique identifier of the product.')` annotation seems a little redundant – isn't that already implied by the URL path? You: (Responding in a Slack message to your reviewer) 'That's a fair point! Let me clarify. While the URL does indicate the product ID, the `@Parameter` annotation here is primarily for improved discoverability and tooling integration. It allows our API gateway and documentation generation tools to consistently map the URL segment to the parameter name, ensuring accurate data binding during request processing.'
This question tests understanding of the *purpose* of annotations beyond simply describing parameters. The `@Parameter` annotation isn't just about repetition; it's a metadata tag used by tools like API gateways and documentation generators to ensure correct data binding. Incorrect options highlight the misconception that annotations only serve a human-readable function or specify data types – which are handled elsewhere (e.g., OpenAPI schema).
24 / 25
Reviewer: 'I'm getting this response from the `/users` endpoint: `HTTP Status: 422 UnprocessableEntity`. The documentation says it should return 200 OK for valid user creation requests. What could be causing this, and what information would you look for in the logs to diagnose the problem?', You: (Responding in a Slack message to your reviewer) 'Okay, let's investigate. This 422 error usually indicates validation issues with the request body. I'd immediately check the API gateway logs for details on the specific validation errors being reported – they often include JSON payloads showing which fields failed validation and why. Specifically, I'd look for messages like 'Invalid email format' or 'Username too long'.'
This question tests understanding of error responses and debugging. The 422 status code signals data validation failures. The key here is recognizing that the problem lies with *what was sent* to the API, not a general server issue or gateway configuration. Examining API gateway logs for specific validation messages (like invalid email formats) is the standard first step in diagnosing such problems. Option A and B are incorrect as they represent broader system issues; option C accurately describes the core problem and how to investigate it.
25 / 25
PR Description:
"Implemented a new API endpoint to update user profiles. Added the `@Updateable(value = 'firstName')` annotation to indicate that this field is mutable via the API."
Reviewer: 'I'm reviewing this PR and noticed the `@Updateable(value = 'firstName')` annotation. It seems a little ambiguous – could you elaborate on *why* `firstName` is specifically marked as updateable, and what other fields might be considered for similar annotations in the future?'
You: (Responding in a Slack message to your reviewer)
This question assesses understanding of the purpose of an `Updateable` annotation. The correct answer emphasizes that it's a signal about *specific* field mutability, not a general rule or prioritization strategy. Incorrect options misinterpret the annotation as dictating exclusive update rights or driving broader API design decisions – the annotation is primarily for developer clarity and potentially tooling integration regarding mutable fields.
What will I practice in "API Annotation Vocabulary"?
This is a Code Comments exercise set. It walks through 25 scenario-based multiple-choice questions built around real usage of Code Comments terminology that IT professionals encounter on the job.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to complete with no account, sign-up, or paywall.
How many questions are in this exercise?
This set contains 25 questions. Each one shows immediate feedback and a detailed explanation after you answer, so you learn the correct usage right away rather than waiting for a final score.
Do I need prior experience to complete this exercise?
No prior experience is required. Each question includes a full explanation covering the reasoning behind the correct answer, so the exercise itself teaches the Code Comments vocabulary as you go.
Can I retry the exercise if I get questions wrong?
Yes — use the "Try again" button on the results screen to reset your answers and go through all the questions again. There is no limit on attempts.
Is my progress saved?
Your answers and score for the current session are tracked in the browser as you go. No account or login is needed, and there is nothing to install.
What if I don't understand a term used in a question?
Read the explanation shown after you answer each question — it breaks down the correct term in plain English with a real-world example. You can also check the site Glossary for quick definitions.
How is this different from reading a blog article on the topic?
Exercises like this one are interactive drills that test and reinforce specific vocabulary through multiple-choice questions, while blog articles explain concepts in prose. Practising here after reading builds active recall, not just passive recognition.
Where can I find more Code Comments exercises?
See the Code Comments exercises hub for the full set of related pages, or browse all exercise categories from the main Exercises index.
Can I use this exercise to prepare for a technical interview?
Yes — Code Comments vocabulary comes up often in technical discussions and interviews. Pair this exercise with our dedicated Interview Preparation section for role-specific practice.