CCAR-F practice question 7 of 10
You are building a structured data extraction system using Claude. The system extracts information from unstructured documents, validates the output…
Full set: 191 questionsThe root cause of the issue is a schema constraint forcing the model to provide a value for a required field, even when the information is absent in the source document. This structural requirement compels the model to hallucinate a plausible value. By changing the field's status from required to optional within the JSON schema, you remove this compulsion. The model is then free to omit the key-value pair from the output if the corresponding data is not found in the text. This is the most direct and effective schema design change to prevent this specific fabrication behavior.
A. This is a prompt engineering technique, not a schema design change as the question specifically asks for.
C. This adds a layer of post-processing complexity and does not prevent the initial hallucination; it only asks the model to report on it.
D. This describes an external, post-processing validation system, not a preventative change to the schema design itself.
1. Anthropic Documentation
"Tool use": The documentation on defining tools for Claude specifies the use of a JSON schema structure for the inputschema. Within this schema
the required array lists all properties that the model must provide values for. By omitting a property from this required array
it becomes optional
allowing the model to exclude it from the output if the information is not present. This directly supports making fields optional to handle missing data.
Reference: Anthropic Claude Documentation
"Concepts > Tool use"
Section: "How to define tools".
2. Anthropic Cookbook
"Prompting for structured data": This guide provides best practices for extracting data into formats like JSON. The examples illustrate that the schema dictates the output structure. A schema that requires a field will force an output for that field
whereas a more flexible schema with optional fields is necessary when the source data is variable and may not contain all possible data points.
Reference: Anthropic Cookbook
"Guides > Prompting for structured data"
Section: "Example: Extracting entities from text".
3. JSON Schema Core Specification (as interpreted by Anthropic): The behavior is rooted in the JSON Schema standard that Anthropic models adhere to for structured outputs. The required keyword is a validation assertion meaning an instance is valid only if it has a value for that property. Removing a property name from the required array makes its presence non-mandatory.
Reference: IETF RFC Draft
"JSON Schema: A Media Type for Describing JSON Documents"
Section 6.5.3: "required". (Note: This is a foundational standard referenced and implemented by Anthropic's tooling).
Keep practicing
Take the free CCAR-F practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other CCAR-F practice questions
- Question 1You are building a customer support resolution agent using the Claude Agent SDK. The agen…
- Question 2Your team is building an MCP integration where Claude needs to fetch real-time inventory …
- Question 3You are building developer productivity tools using the Claude Agent SDK. The agent helps…
- Question 4You are integrating Claude Code into your Continuous Integration/Continuous Deployment (C…
- Question 6You are building a structured data extraction system using Claude. The system extracts in…
- Question 9True or False: When designing a multi-step agentic workflow, it is a best practice to exp…
