# Enforce structured output using tool use and JSON schemas — Practice reading

Exam: CCAR-F — Claude Certified Architect - Foundations (CCAR-F)
Knowledge domain: Prompt Engineering & Structured Output
HTML: https://learningpathx.com/learning-path/CCAR-F/learn/449

This public learning practice includes correct answers and existing explanations. Reading does not save progress or create a test.

## Question 1

Type: multiple\_choice
Knowledge point: Tool use (tool\_use) with JSON schemas as the most reliable approach for guaranteed schema-compliant structured output, eliminating JSON syntax errors

For an Anthropic Messages model and thinking configuration that support forced tool use, which two settings require a handoff tool-use request with schema-valid inputs? (Choose 2.)

### Options

**A**

Include a tool named escalate\_to\_human with its input\_schema and strict: true in the tools list.

**B**

Set tool\_choice to {"type": "tool", "name": "escalate\_to\_human"}.

**C**

Force a text-only response and rely on it to execute the human handoff.

**D**

Request text summaries instead of tools.

Correct answer: A, B

### Explanation

The stated model and thinking configuration must support forced tool use. Schema validity does not establish business eligibility or delivery; the client validates and executes the handoff.

## Question 2

Type: single\_choice
Knowledge point: Tool use (tool\_use) with JSON schemas as the most reliable approach for guaranteed schema-compliant structured output, eliminating JSON syntax errors

For a supported JSON Schema in a normally completed custom-tool call, excluding refusals and truncation, what does strict: true provide?

### Options

**A**

It enforces valid JSON, required properties and supported field types, subject to documented provider exceptions.

**B**

It requires this tool to be selected even when tool\_choice allows a direct response.

**C**

It guarantees every argument value agrees with the source document.

**D**

It guarantees a requested business action will succeed when the tool executes.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — It enforces valid JSON, required properties and supported field types, subject to documented provider exceptions.**: Strict generation enforces the supported structural contract, subject to the stated completion conditions and provider exceptions.
* **B — It requires this tool to be selected even when tool\_choice allows a direct response.**: Tool choice controls whether a tool is requested; strictness controls argument structure.
* **C — It guarantees every argument value agrees with the source document.**: Source truth requires separate semantic validation.
* **D — It guarantees a requested business action will succeed when the tool executes.**: Valid arguments do not guarantee runtime business success.

## Question 3

Type: single\_choice
Knowledge point: Tool use (tool\_use) with JSON schemas as the most reliable approach for guaranteed schema-compliant structured output, eliminating JSON syntax errors

A pipeline uses a model/configuration that supports strict tools and forced tool choice. It must receive a completed classify\_ticket call with required string ticket\_id and integer category\_id limited to 1 or 2\. Logs show three failures: malformed free-text JSON, prose-only answers with no tool call, and complete but unsupported classifications. Increasing retries costs too much. Which design addresses the structural failures while retaining the necessary factual check?

### Options

**A**

Define classify\_ticket with strict: true and the required schema, force that named tool, and admit completed inputs only after source-based classification validation.

**B**

Define the strict schema but keep tool\_choice auto and accept any prose answer after regex parsing.

**C**

Force classify\_ticket without strict: true and remove validation because the named choice guarantees correct arguments and labels.

**D**

Use strict: true and a forced named call, then treat every integer category\_id allowed by the schema as factually correct.

Correct answer: A

### Explanation

Schema-constrained arguments, required tool invocation and evidence-based classification checks address different observed failures. Token truncation, refusals and other incomplete outcomes still need separate handling.

## Question 4

Type: single\_choice
Knowledge point: Tool use (tool\_use) with JSON schemas as the most reliable approach for guaranteed schema-compliant structured output, eliminating JSON syntax errors

A current Claude Code Agent SDK structured-output schema contains "format": "email", and an application requires validation that a returned value complies with the application's email syntax rules, without claiming mailbox deliverability or ownership. What conclusion follows from the documented behavior?

### Options

**A**

The format keyword is an annotation, requiring external validation processes.

**B**

The format keyword strictly enforces email validation through schema conformance rules.

**C**

A successful syntax check proves that the mailbox exists and belongs to the named person.

**D**

Accept any string if the format annotation is present, without applying the application’s required check.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — The format keyword is an annotation, requiring external validation processes.**: In the stated Agent SDK behavior, format is an annotation; the application must enforce its syntax rule separately.
* **B — The format keyword strictly enforces email validation through schema conformance rules.**: The format annotation is not strictly enforced by Claude Code.
* **C — A successful syntax check proves that the mailbox exists and belongs to the named person.**: Syntax validation does not establish mailbox existence or ownership.
* **D — Accept any string if the format annotation is present, without applying the application’s required check.**: The annotation does not replace the required application validation.

## Question 5

Type: single\_choice
Knowledge point: The distinction between tool\_choice: "auto" (model may return text instead of calling a tool), "any" (model must call a tool but can choose which), and forced tool selection (model must call a specific named tool)

A supported model/configuration processes invoices and receipts in three stages. Initially, stage 1 exposes extract\_invoice, extract\_receipt and archive\_record under tool\_choice any; a trace shows archive\_record called before any extraction. A trial exposes only the two extractors but switches to auto; another trace contains prose and no extraction. Once an extraction is complete and validated, stage 2 must archive it; its inventory includes archive\_record and the read-only lookup\_archive\_status tool. Under any, a stage-2 trace calls only lookup\_archive\_status. Stage 3 receives the archive result and offers only lookup\_archive\_status: it should answer directly when that result suffices but may look up missing information. Which configuration addresses the observed failures while retaining adaptive extraction and the required stage transition?

### Options

**A**

Stage 1: expose only the two extractors with any; after validated extraction, stage 2: force archive\_record; stage 3: retain the read-only inventory with auto.

**B**

Stage 1: retain all three original tools with any; after validated extraction, stage 2: force archive\_record; stage 3: retain the read-only inventory with auto.

**C**

Stage 1: expose only the two extractors with auto; after validated extraction, stage 2: use any; stage 3: retain the read-only inventory with auto.

**D**

Stage 1: expose only the two extractors and force extract\_invoice; after validated extraction, stage 2: force archive\_record; stage 3: retain the read-only inventory with any.

Correct answer: A

### Explanation

The traces expose different gaps: any selects from the entire offered inventory, auto can omit extraction, and any does not require the archive operation when a status lookup is also offered. The application must retain the validation boundary between stages. Use the offered tool inventory and tool-choice mode together: mandatory adaptive extraction, a required named archival call after validation, then optional read-only assistance.

## Question 6

Type: single\_choice
Knowledge point: The distinction between tool\_choice: "auto" (model may return text instead of calling a tool), "any" (model must call a tool but can choose which), and forced tool selection (model must call a specific named tool)

A help assistant exposes lookup\_order and cancel\_order. A test request 'Thanks, that answers my question' under tool\_choice:{type:'any'} produces an unnecessary lookup\_order call. The next turn may instead ask 'Where is order 17?'. The product requires both direct acknowledgments and the ability to look up orders. In a model configuration supporting all listed modes, which change satisfies both turns?

### Options

**A**

Use tool\_choice:{type:'auto'}, accept a direct acknowledgment, and keep the tools available for the later lookup.

**B**

Use tool\_choice:{type:'none'} for every turn, including the later order question.

**C**

Force lookup\_order by name for every turn because it was the tool selected in the test.

**D**

Keep any and reject all text-only acknowledgments as invalid.

Correct answer: A

### Explanation

The trace exposes an unnecessary forced call. Auto permits text for the acknowledgment while retaining tool availability for the subsequent order request.

## Question 7

Type: single\_choice
Knowledge point: That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)

A structured response has passed validation against a schema that declares required fields, shapes, and types. What does that successful validation directly establish?

### Options

**A**

The response matches the required shapes and types.

**B**

Line items correctly sum to the reported total.

**C**

Each extracted value holds the correct business meaning.

**D**

A string is placed in its semantically intended field.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — The response matches the required shapes and types.**: Schema validation checks required structure and declared types.
* **B — Line items correctly sum to the reported total.**: Summing line items is a semantic or business-logic check.
* **C — Each extracted value holds the correct business meaning.**: Extracting correct business meaning is outside structural validation.
* **D — A string is placed in its semantically intended field.**: A string can have the correct type while being placed in the wrong semantic field.

## Question 8

Type: single\_choice
Knowledge point: That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)

An invoice response passes its schema. The contract defines total as sum(line\_items) minus discount plus tax. The returned values violate that relation. Which downstream check detects this error?

### Options

**A**

Recompute sum(line\_items) - discount + tax and compare it with total using the contract’s rounding tolerance.

**B**

Compare sum(line\_items) directly with total, ignoring discount and tax.

**C**

Check that total, discount, and tax are individually nonnegative numbers.

**D**

Check that line\_items is nonempty and total is present.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Recompute sum(line\_items) - discount + tax and compare it with total using the contract’s rounding tolerance.**: It validates the complete stated business relationship.
* **B — Compare sum(line\_items) directly with total, ignoring discount and tax.**: It omits terms explicitly required by the contract.
* **C — Check that total, discount, and tax are individually nonnegative numbers.**: Valid individual values can still be mutually inconsistent.
* **D — Check that line\_items is nonempty and total is present.**: Presence checks do not verify arithmetic consistency.

## Question 9

Type: single\_choice
Knowledge point: That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)

An invoice states seller North, buyer South, two items of 40 each, tax 8 and total 88\. A completed strict-tool result is {"seller":"South","buyer":"North","items":\[40,40\],"tax":8,"total":80}; all properties and types satisfy its schema. No payment has been sent. Which response best diagnoses and repairs the result without concealing source disagreement?

### Options

**A**

Block downstream use; report the seller/buyer reversal and the 40+40+8 total mismatch, then re-extract with the source roles and arithmetic errors supplied as feedback.

**B**

Change total to 88 and accept the result, because arithmetic is the only semantic relationship a strict schema can miss.

**C**

Accept the result because all fields pass strict validation, and use seller as the payment destination.

**D**

Swap seller and buyer but keep total 80, because a valid item subtotal should override the document's tax-inclusive total.

Correct answer: A

### Explanation

The result has two independent semantic failures despite valid structure: reversed party roles and a total that omits the stated tax.

## Question 10

Type: multiple\_choice
Knowledge point: That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)

A payment extractor emits completed strict-tool inputs with a required numeric array line\_amounts, required numbers tax, discount and total, and required strings vendor and buyer. The source has line amounts 60 and 40, tax 10, discount 5, total 105, vendor Elm and buyer Fir. Run R emits the correct names and components but total 115\. Run S emits total 105 and the right components but swaps vendor and buyer. The team wants to preserve valid extraction speed while preventing these records from reaching accounting. Which two changes target the independent defects? (Choose 2.)

### Options

**A**

Recompute sum(line\_amounts) + tax - discount from verified components and reject R's total mismatch.

**B**

Check each party field against its labeled source evidence and reject S's reversed assignments.

**C**

Reject all records with a discount because a strict schema cannot contain arithmetically related numeric fields.

**D**

Treat S as fully correct because its successful arithmetic check also establishes correct party attribution.

Correct answer: A, B

### Explanation

R fails the total relationship; S demonstrates that passing that relationship does not validate unrelated field meaning. Keep structural enforcement and add targeted semantic gates.

## Question 11

Type: multiple\_choice
Knowledge point: Schema design considerations: required vs optional fields, enum fields with "other" + detail string patterns for extensible categories

A schema declares required note with type string or null, optional tag with type string, and no other constraints. Which two objects validate? (Choose 2.)

### Options

**A**

{"note":null}

**B**

{"note":"checked","tag":"reviewed"}

**C**

{"tag":"reviewed"}

**D**

{"note":"checked","tag":null}

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — {"note":null}**: The required key is present and null is explicitly permitted.
* **B — {"note":"checked","tag":"reviewed"}**: The required note and optional tag have allowed string values.
* **C — {"tag":"reviewed"}**: The required note key is missing.
* **D — {"note":"checked","tag":null}**: Optional means the tag may be absent, not that a present tag may be null.

## Question 12

Type: single\_choice
Knowledge point: Schema design considerations: required vs optional fields, enum fields with "other" + detail string patterns for extensible categories

An application has standard category values but also receives legitimate new categories that need explanatory text. Which schema design most directly balances consistency with extensibility?

### Options

**A**

Include other in the category enum and add a detail string, requiring a useful detail when other is selected.

**B**

Use a rigid enum structure that provides no mechanism to represent any new category.

**C**

Add other to the enum but provide no place to record the specific new category.

**D**

Add a detail string but leave the category enum unable to represent any unlisted category.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Include other in the category enum and add a detail string, requiring a useful detail when other is selected.**: It retains controlled standard categories and an explicitly valid other-plus-detail path.
* **B — Use a rigid enum structure that provides no mechanism to represent any new category.**: A rigid enum structure provides no mechanism for open-ended categories.
* **C — Add other to the enum but provide no place to record the specific new category.**: It records that the category is unlisted but loses the requested explanatory detail.
* **D — Add a detail string but leave the category enum unable to represent any unlisted category.**: A detail field alone does not make an out-of-enum category valid.

## Question 13

Type: single\_choice
Knowledge point: Schema design considerations: required vs optional fields, enum fields with "other" + detail string patterns for extensible categories

A triage contract currently requires category in {billing,access}, callback\_phone and detail. Record R1 is a clear billing request with no phone and no need for a callback. R2 is an identified data-export request with a callback phone; export is a valid new category. The business must keep controlled category labels, accept requests without nonessential contact data and preserve why an unlisted type was chosen. Which redesign meets all three constraints?

### Options

**A**

Add other to category, require meaningful detail when other is used through application validation, and make callback\_phone optional while retaining required category.

**B**

Keep both categories, make callback\_phone optional, and map export to billing because a closed enum needs no new label.

**C**

Replace category with unrestricted text and make all fields required so downstream consumers can interpret any new type.

**D**

Add other and make callback\_phone required but nullable, then accept empty detail for other because structural validity establishes category meaning.

Correct answer: A

### Explanation

R1 demonstrates that callback contact is nonessential; R2 requires a controlled extension that preserves its stated meaning. Conditional detail validation prevents an empty other label from losing that meaning.

## Question 14

Type: multiple\_choice
Knowledge point: Defining extraction tools with JSON schemas as input parameters and extracting structured data from the tool\_use response

An invoice extraction tool declares total as a string. The consumer expects a number and reads response.content\[0\].text. A recorded response contains content\[0\] = {"type":"text","text":"Invoice checked"} and content\[1\] = {"type":"tool\_use","id":"u7","name":"extract\_invoice","input":{"invoice\_id":"I7","total":"125.50"}}. The consumer reports "missing invoice"; earlier tests that regex-parsed prose also accepted nonnumeric totals. Which two changes address both causes while retaining structured extraction? (Choose 2.)

### Options

**A**

Define total as a number in extract\_invoice.input\_schema and use strict tool arguments on a supported configuration.

**B**

Read the final content block by position and parse whichever text it contains as the invoice.

**C**

Find the tool\_use block with name extract\_invoice, read its input, and validate it before downstream use.

**D**

Keep the string schema and wait for a tool\_result to appear in this assistant response before processing anything.

Correct answer: A, C

### Explanation

The schema and response reader are separate defects. Correct the numeric contract and select the named tool-use input by block type, not a text position.

## Question 15

Type: single\_choice
Knowledge point: Defining extraction tools with JSON schemas as input parameters and extracting structured data from the tool\_use response

The application will continue the agent loop after handling a normally completed extraction tool\_use block. What should it do with the block’s input arguments?

### Options

**A**

Validate and consume the arguments, perform the required tool logic, and return a tool\_result matching the tool\_use ID.

**B**

Return the parsed arguments as an assistant-authored message without the matching tool\_use ID.

**C**

Start the next model request before handling the requested tool result.

**D**

Treat the arguments as a replacement input\_schema for the next request.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Validate and consume the arguments, perform the required tool logic, and return a tool\_result matching the tool\_use ID.**: The continuing loop needs a validated tool outcome associated with the original request.
* **B — Return the parsed arguments as an assistant-authored message without the matching tool\_use ID.**: Client-tool outcomes should be returned in the matching tool\_result, not invented as assistant output.
* **C — Start the next model request before handling the requested tool result.**: The next iteration needs the requested result to reason about the outcome.
* **D — Treat the arguments as a replacement input\_schema for the next request.**: Generated arguments are an instance of the schema, not its replacement.

## Question 16

Type: single\_choice
Knowledge point: Defining extraction tools with JSON schemas as input parameters and extracting structured data from the tool\_use response

A service currently asks Claude to describe purchase-order fields in prose, then parses the response with custom text rules. It needs a typed extraction contract for downstream processing. Which redesign directly addresses that need?

### Options

**A**

Define a supported strict tool with input\_schema and strict: true, then validate and consume the matching returned tool\_use inputs.

**B**

Retain the prose request and expand the custom parser with additional pattern rules.

**C**

Ask Claude to place the same prose response inside a formatted Markdown code fence.

**D**

Request a longer and more detailed explanation of each extracted field.

Correct answer: A

### Explanation

The schema defines the template and strict: true enforces its supported structural constraints. The application still parses the matching block and validates business meaning and source support.

## Question 17

Type: single\_choice
Knowledge point: Setting tool\_choice: "any" to guarantee structured output when multiple extraction schemas exist and the document type is unknown

On a model and configuration supporting forced tool use, an extraction service receives documents that may be invoices or receipts. Which tool\_choice setting requires Claude to select one of the provided extraction tools?

### Options

**A**

{"type":"any"}

**B**

{"type":"auto"}

**C**

{"type":"tool","name":"extract\_invoice"}

**D**

Omit tool\_choice from the request.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — {"type":"any"}**: Any requires a request to a provided tool while preserving the invoice-versus-receipt selection; it does not execute the selected client tool.
* **B — {"type":"auto"}**: auto permits a direct response instead of a tool call.
* **C — {"type":"tool","name":"extract\_invoice"}**: This forces one named tool rather than allowing a choice among schemas.
* **D — Omit tool\_choice from the request.**: Omitting the setting leaves the default auto behavior.

## Question 18

Type: single\_choice
Knowledge point: Setting tool\_choice: "any" to guarantee structured output when multiple extraction schemas exist and the document type is unknown

A document pipeline has invoice and receipt tools. Config P uses auto with both tools strict and sometimes emits prose. Config Q changes P to any but enables manual extended thinking and receives an unsupported-setting error. Config R forces invoice by name and produces structurally valid invoice records even for receipts. The chosen model supports forced tools when manual thinking is disabled. The pipeline must eliminate the prose bypass and preserve model choice between schemas. Which configuration addresses all three observations?

### Options

**A**

Disable manual thinking for this request, keep both extraction tools strict, and set tool\_choice to {"type":"any"}.

**B**

Keep manual thinking and tool\_choice:{"type":"any"}, but increase the retry count because the unsupported-setting error indicates low confidence.

**C**

Use tool\_choice:{"type":"tool","name":"extract\_invoice"} with strict:true and rename the invoice tool description to include receipts without changing its schema.

**D**

Use tool\_choice:{"type":"auto"} with both strict tools because strict input validation also requires a tool to be selected.

Correct answer: A

### Explanation

The observations identify separate selection, compatibility and schema-choice issues. Compatible any selection with both strict tools closes the prose path without hard-wiring the wrong document schema.

## Question 19

Type: multiple\_choice
Knowledge point: Setting tool\_choice: "any" to guarantee structured output when multiple extraction schemas exist and the document type is unknown

A supported request uses tool\_choice any and supplies extract\_invoice, extract\_receipt, and search\_web. Which two conclusions follow? (Choose 2.)

### Options

**A**

A tool request is required, but any alone does not guarantee that it is an extraction tool.

**B**

If this stage must choose only an extraction schema, expose only the eligible extraction tools for the stage.

**C**

Any automatically ignores search\_web because two of the tools are extraction tools.

**D**

Any selects the alphabetically first tool and therefore determines the document type.

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — A tool request is required, but any alone does not guarantee that it is an extraction tool.**: Any ranges over the provided tool inventory.
* **B — If this stage must choose only an extraction schema, expose only the eligible extraction tools for the stage.**: Narrowing the exposed inventory limits the available choices to the intended schemas.
* **C — Any automatically ignores search\_web because two of the tools are extraction tools.**: Any does not infer a restricted subset from majority tool purpose.
* **D — Any selects the alphabetically first tool and therefore determines the document type.**: Any does not impose alphabetical selection.

## Question 20

Type: multiple\_choice
Knowledge point: Setting tool\_choice: "any" to guarantee structured output when multiple extraction schemas exist and the document type is unknown

Invoices and receipts both contain merchant, date, and amount fields. A supported any-mode extraction request must select the appropriate schema. Which two design choices help? (Choose 2.)

### Options

**A**

Provide distinct invoice and receipt extraction tool definitions for their respective output contracts.

**B**

Describe invoices as payment requests and receipts as payment acknowledgments, and give each a supported strict argument schema.

**C**

Give both tools the description “extract merchant, date, and amount” without document-type boundaries.

**D**

Select extract\_invoice for every document solely because both document types contain an amount.

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — Provide distinct invoice and receipt extraction tool definitions for their respective output contracts.**: Distinct definitions represent the intended alternative contracts.
* **B — Describe invoices as payment requests and receipts as payment acknowledgments, and give each a supported strict argument schema.**: The descriptions supply the semantic distinction while strict schemas constrain the selected structure.
* **C — Give both tools the description “extract merchant, date, and amount” without document-type boundaries.**: Shared fields alone do not differentiate document types.
* **D — Select extract\_invoice for every document solely because both document types contain an amount.**: An overlapping field does not establish invoice identity.

## Question 21

Type: single\_choice
Knowledge point: Forcing a specific tool with tool\_choice: {"type": "tool", "name": "extract\_metadata"} to ensure a particular extraction runs before enrichment steps

On a model and thinking configuration that support forced tool use, which tool\_choice object selects an extract\_metadata request before the application enables enrichment?

### Options

**A**

{"type":"tool","name":"extract\_metadata"}

**B**

{"type":"auto"}

**C**

{"type":"any"}

**D**

Omit tool\_choice from the request.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — {"type":"tool","name":"extract\_metadata"}**: The object requests extract\_metadata by its exact supplied name. The application still executes the tool, validates its result, and enables enrichment only after the prerequisite succeeds.
* **B — {"type":"auto"}**: auto permits autonomous tool selection or a direct response.
* **C — {"type":"any"}**: any requires a tool call but does not select this particular tool.
* **D — Omit tool\_choice from the request.**: Omitting the parameter leaves the default autonomous selection behavior.

## Question 22

Type: single\_choice
Knowledge point: Forcing a specific tool with tool\_choice: {"type": "tool", "name": "extract\_metadata"} to ensure a particular extraction runs before enrichment steps

A pipeline requires one metadata extraction before enrichment and must avoid multiple extraction calls in that turn. Assume a model and thinking configuration that support forced tool use. Which request configuration selects exactly one metadata tool-use request for the application to execute and validate?

### Options

**A**

Set tool\_choice to {"type":"tool","name":"extract\_metadata","disable\_parallel\_tool\_use":true}.

**B**

Set tool\_choice to {"type":"tool","name":"extract\_metadata"} and omit disable\_parallel\_tool\_use.

**C**

Set tool\_choice to {"type":"tool","name":"extract\_metadata"} and place disable\_parallel\_tool\_use:true as a separate top-level request parameter.

**D**

Set tool\_choice to {"type":"auto","disable\_parallel\_tool\_use":true} and ask the model to extract metadata.

Correct answer: A

### Explanation

The compatible named choice with disable\_parallel\_tool\_use inside tool\_choice requests exactly one tool. The application must execute it and verify metadata before enrichment.

## Question 23

Type: single\_choice
Knowledge point: Forcing a specific tool with tool\_choice: {"type": "tool", "name": "extract\_metadata"} to ensure a particular extraction runs before enrichment steps

A metadata pipeline has two client tools, extract\_metadata and enrich\_record, on a configuration that supports forced tool use. Enrichment must use the document\_id from a validated extraction in the same run. With both tools exposed under any, traces sometimes contain enrich\_record first. Forcing extract\_metadata fixes that symptom, but a scheduler still launches queued enrichment after a max\_tokens response with incomplete metadata. Which design meets the ordering and data-dependency requirements?

### Options

**A**

Force extract\_metadata for the extraction request, expose or dispatch enrichment only after completed metadata passes validation, and pass the validated document\_id to the next stage.

**B**

Use any with both tools and insert stronger prose saying that extraction should precede enrichment.

**C**

Force extract\_metadata but let enrichment use the last document\_id in the cache whenever the response is incomplete.

**D**

Force enrich\_record first and ask that tool's prompt to reconstruct metadata from the same document.

Correct answer: A

### Explanation

A named tool choice controls the model's required call; the application gate controls whether downstream work may proceed after that call. An incomplete response does not satisfy the prerequisite.

## Question 24

Type: multiple\_choice
Knowledge point: Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fields

Two extraction consumers use standard JSON Schema semantics. Consumer S stores a full snapshot and requires headquarters to appear in every object; null means the source does not state it. Consumer P applies partial updates: an omitted headquarters key leaves the stored value untouched, but null clears it. Neither consumer permits guessing from prior examples. A new document names the company but does not state headquarters. Which two schema/output choices preserve these distinct contracts? (Choose 2.)

### Options

**A**

For S, require headquarters, permit string or null, and return headquarters: null with no invented location.

**B**

For P, define headquarters as an optional string property and omit it when this document provides no update.

**C**

For S, omit headquarters from both required and the output, because omission always means the same thing as null.

**D**

For P, require a nullable headquarters and return null, because absence in a new source proves the stored headquarters should be cleared.

Correct answer: A, B

### Explanation

Optional and nullable represent different states. The correct design follows each consumer's explicit interpretation of omission and null while avoiding fabricated facts.

## Question 25

Type: single\_choice
Knowledge point: Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fields

How is a schema property made optional in a JSON Schema extraction design?

### Options

**A**

Define in properties, exclude from required array.

**B**

Include the field exclusively within the required array.

**C**

Remove it from both properties and required arrays.

**D**

Add a format annotation directly to the property.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Define in properties, exclude from required array.**: Define the property and omit it from required to permit absence. Allowing null is a separate value-type decision and does not by itself make the key optional.
* **B — Include the field exclusively within the required array.**: Including a field exclusively in the required array identifies it as mandatory, not optional.
* **C — Remove it from both properties and required arrays.**: Removing the declaration loses its explicit type constraints; it does not necessarily prohibit that field, because additional properties are allowed by default unless separately restricted.
* **D — Add a format annotation directly to the property.**: Adding a format annotation directly to the property does not control whether it is optional.

## Question 26

Type: single\_choice
Knowledge point: Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fields

Contact records processed with current Claude Code Agent SDK structured output often lack email addresses. For this setup, format is accepted as an annotation and is not enforced. A team keeps email required and adds "format":"email", then sees invented email values. Which redesign directly addresses both the absence problem and the ineffective validation assumption?

### Options

**A**

Keep email typed in properties but optional, and separately validate any supplied address and its source support.

**B**

Keep the email field required and add another format annotation for validation.

**C**

Completely remove the email field from the schema, even when the source documents contain it.

**D**

Keep email required and substitute a syntactically valid default address whenever the source omits it.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Keep email typed in properties but optional, and separately validate any supplied address and its source support.**: It permits absence while preserving source-supported addresses. A string type and unenforced format annotation do not replace appropriate address validation.
* **B — Keep the email field required and add another format annotation for validation.**: Adding another format annotation does not make a required field safely optional or strictly enforce the value.
* **C — Completely remove the email field from the schema, even when the source documents contain it.**: The email field should remain available in the schema for documents that actually include it.
* **D — Keep email required and substitute a syntactically valid default address whenever the source omits it.**: A default address invents a source fact even if its syntax is valid.

## Question 27

Type: multiple\_choice
Knowledge point: Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fields

Source X states “Acme, founded 2001”; source Y states “Beta” with no founding year. founded\_year is an optional integer property. Which two outputs preserve the available facts? (Choose 2.)

### Options

**A**

X → {"company\_name":"Acme","founded\_year":2001}

**B**

Y → {"company\_name":"Beta"}

**C**

X → {"company\_name":"Acme","founded\_year":null}

**D**

Y → {"company\_name":"Beta","founded\_year":2001}

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — X → {"company\_name":"Acme","founded\_year":2001}**: It retains the explicit integer year.
* **B — Y → {"company\_name":"Beta"}**: It omits the optional field whose value is absent.
* **C — X → {"company\_name":"Acme","founded\_year":null}**: The known year should be extracted, and null is not permitted by the stated integer type.
* **D — Y → {"company\_name":"Beta","founded\_year":2001}**: The year from another source is not evidence about Beta.

## Question 28

Type: single\_choice
Knowledge point: Adding enum values like "unclear" for ambiguous cases and "other" + detail fields for extensible categorization

A ticket schema permits bug, feature, and documentation categories. A request concerns an unfamiliar operational concern that fits none of them. Which output design preserves a valid structured record while retaining the specific classification information?

### Options

**A**

Extend the category enum with other, define category\_detail as a string, and use those fields to preserve the unfamiliar category.

**B**

Select the bug category and discard the unfamiliar classification.

**C**

Add an unvalidated free-text category outside of the schema.

**D**

Reject the request as it lacks a matching category value.

Correct answer: A

### Explanation

An other enum value paired with a detail field provides a compliant path for categories outside the predefined set.

## Question 29

Type: single\_choice
Knowledge point: Adding enum values like "unclear" for ambiguous cases and "other" + detail fields for extensible categorization

A support request does not provide enough evidence to assign critical, high, medium, or low priority. What schema change lets the extractor represent that uncertainty without selecting an incorrect priority?

### Options

**A**

Allow unclear in the priority enum and record the missing evidence in separate reason and clarification fields.

**B**

Select critical priority until new evidence appears.

**C**

Add other to priority and treat every unknown urgency as a known new priority category.

**D**

Keep the original priority enum and insert an explanatory sentence as its value.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Allow unclear in the priority enum and record the missing evidence in separate reason and clarification fields.**: It represents uncertainty while preserving the evidence needed to clarify it.
* **B — Select critical priority until new evidence appears.**: Selecting a critical priority value would result in an unsupported and inaccurate classification.
* **C — Add other to priority and treat every unknown urgency as a known new priority category.**: Unclear urgency is not a confirmed new priority category.
* **D — Keep the original priority enum and insert an explanatory sentence as its value.**: An explanation does not satisfy the unchanged enum.

## Question 30

Type: multiple\_choice
Knowledge point: Adding enum values like "unclear" for ambiguous cases and "other" + detail fields for extensible categorization

A schema permits category values billing, access, other, and unclear, with detail for other. Request X clearly asks for data export, an unlisted service; request Y says only “Please help.” Which two mappings fit? (Choose 2.)

### Options

**A**

Y: unclear, with a request for the missing intent.

**B**

X: other, with detail identifying data export.

**C**

X: unclear, because every unlisted category lacks identifiable intent.

**D**

Y: other, with detail guessing that the user wants data export.

Correct answer: A, B

### Explanation

Correct answers: A, B.

Option analysis:

* **A — Y: unclear, with a request for the missing intent.**: The intent is insufficiently specified.
* **B — X: other, with detail identifying data export.**: The category is known but outside the standard set.
* **C — X: unclear, because every unlisted category lacks identifiable intent.**: Unlisted does not mean unknown.
* **D — Y: other, with detail guessing that the user wants data export.**: The vague request does not support that specific new category.

## Question 31

Type: single\_choice
Knowledge point: Adding enum values like "unclear" for ambiguous cases and "other" + detail fields for extensible categorization

A router’s standard categories are billing and access; standard priorities are high and low. Its schema also explicitly allows category other with detail and priority unclear. Policy defines high as a stated current outage, low as explicitly nonurgent, and unclear when urgency cannot be determined. Record X says 'Schedule a data export next month; not urgent.' Record Y says 'Help with my bill as soon as possible' but gives no outage or nonurgent statement. Category detail is required for other; unclear must not be silently treated as low. Which mapping preserves both meaning and the controlled schema?

### Options

**A**

X: category other, detail data export, priority low; Y: category billing, priority unclear, routed for urgency clarification.

**B**

X: category unclear, priority low; Y: category billing, priority other, detail as soon as possible.

**C**

X: category other, detail data export, priority low; Y: category billing, priority high, because as soon as possible proves an outage.

**D**

X: category billing, priority low; Y: category billing, priority low, because only the originally listed values should be retained.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — X: category other, detail data export, priority low; Y: category billing, priority unclear, routed for urgency clarification.**: It preserves the novel category's meaning and routes unresolved urgency without inventing an outage or low-priority determination.
* **B — X: category unclear, priority low; Y: category billing, priority other, detail as soon as possible.**: It confuses categorical extension with uncertainty and assigns fallback values to the wrong fields.
* **C — X: category other, detail data export, priority low; Y: category billing, priority high, because as soon as possible proves an outage.**: The phrase expresses a preference for speed but does not establish the policy's required current outage.
* **D — X: category billing, priority low; Y: category billing, priority low, because only the originally listed values should be retained.**: It mislabels the export request and silently converts unresolved urgency into low, contrary to both constraints.

## Question 32

Type: multiple\_choice
Knowledge point: Including format normalization rules in prompts alongside strict output schemas to handle inconsistent source formatting

A strict extraction schema requires string date, number amount and string currency. Two verified USD records use different date conventions: R1 metadata says DD/MM/YYYY and text says '03/04/2026; US dollars 1,250.00'; R2 metadata says MM/DD/YYYY and text says '03/04/2026; USD 1,250.00'. The model returns 2026-03-04 for both dates and amount 1.25 for both. Which two prompt-and-validation changes address the observed representation errors while preserving the strict structure? (Choose 2.)

### Options

**A**

Condition date normalization on each record's declared convention: R1 becomes 2026-04-03 and R2 becomes 2026-03-04.

**B**

Specify the stated amount separators and verified currency identity: both amounts remain 1250.00 and currency becomes USD, then check those transformations against the sources.

**C**

Use one global US date convention because it produced a valid ISO-shaped date for both records.

**D**

Keep 1.25 and multiply it only when the currency label contains the words US dollars, because different labels imply different currency scales.

Correct answer: A, B

### Explanation

Both outputs are structurally acceptable but normalize source meaning incorrectly. Record-specific date conventions and stated numeric separators resolve the errors without currency conversion.

## Question 33

Type: single\_choice
Knowledge point: Including format normalization rules in prompts alongside strict output schemas to handle inconsistent source formatting

In the Agent SDK structured-output setup used here, format is accepted but not enforced. How should the application treat an email format annotation?

### Options

**A**

As guidance that still requires the application’s email syntax validation.

**B**

As a transformation that repairs invalid source email strings automatically.

**C**

As a replacement for declaring the field’s string type.

**D**

As proof that a returned email address exists and belongs to the source person.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — As guidance that still requires the application’s email syntax validation.**: The stated annotation behavior leaves enforcement to application validation.
* **B — As a transformation that repairs invalid source email strings automatically.**: An annotation does not transform source values.
* **C — As a replacement for declaring the field’s string type.**: The field type remains a separate structural declaration.
* **D — As proof that a returned email address exists and belongs to the source person.**: Even syntax enforcement would not establish ownership or deliverability.

## Question 34

Type: single\_choice
Knowledge point: Including format normalization rules in prompts alongside strict output schemas to handle inconsistent source formatting

An extractor already returns valid JSON with a currency string field, and source verification confirms every amount is in US dollars, but currency labels appear as $, US dollars or USD. What prompt addition directly improves the field's consistency?

### Options

**A**

Normalize those verified labels to the currency code USD without changing the numeric amounts.

**B**

Normalize every label to CAD while retaining the numeric amounts.

**C**

Add only a basic format annotation to the schema field.

**D**

Ask the model for a longer narrative explaining each amount.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — Normalize those verified labels to the currency code USD without changing the numeric amounts.**: It explicitly directs the desired currency normalization.
* **B — Normalize every label to CAD while retaining the numeric amounts.**: CAD changes the verified currency identity rather than standardizing its USD labels.
* **C — Add only a basic format annotation to the schema field.**: A basic format annotation does not enforce the needed standardization.
* **D — Ask the model for a longer narrative explaining each amount.**: A longer narrative does not normalize the structured currency value.

## Question 35

Type: single\_choice
Knowledge point: Including format normalization rules in prompts alongside strict output schemas to handle inconsistent source formatting

An extraction response has passed its required-field and type checks. Which conclusion correctly describes what the schema has established?

### Options

**A**

The structural contract passed; source attribution and requested value normalization still require checking.

**B**

All ambiguous dates have been interpreted using the correct source locale.

**C**

Every normalized currency label matches the source currency identity.

**D**

Every value was copied from the correct source record.

Correct answer: A

### Explanation

Correct answer: A.

Option analysis:

* **A — The structural contract passed; source attribution and requested value normalization still require checking.**: Structural validity does not establish semantic correctness.
* **B — All ambiguous dates have been interpreted using the correct source locale.**: Locale interpretation is a content decision.
* **C — Every normalized currency label matches the source currency identity.**: Currency identity requires source evidence.
* **D — Every value was copied from the correct source record.**: Correct attribution is not guaranteed by matching field types.

