Question 10
A response renderer assumes response.content[0].text always contains the answer. After tool use is enabled, it crashes when the first block has a different type. What is the most appropriate repair?
- Read only the final array element because the answer is guaranteed to be last.
- Dispatch on each content block’s type and render or handle only the fields defined for that type.
- Convert the whole response object to a string and show it as the assistant answer.
- Treat every non-text block as proof that the API returned a transport error.
Explanation
Correct Answer
B:The content array can carry different structured block kinds. A type-aware consumer can route tool calls to execution logic and collect text for display without assuming every block has a text property.
Incorrect Answers
A:Changing the index retains the same fragile assumption. The renderer should use explicit block types rather than rely on a universal ordering guarantee that the integration has not established.
C:Stringifying avoids the missing-property access but mixes protocol data with user-facing content. It also does not perform the required handling of tool requests or preserve a deliberate rendering contract.
D:A successful response can legitimately contain tool-use or other supported blocks. Transport failures and content types are different layers; conflating them discards valid responses.
Question 11
A streamed tool request produces several input_json_delta events. Individual partial_json fragments are not valid standalone JSON. The tool changes an external record. How should the application consume the fragments?
- Execute the tool for every fragment containing a recognizable field name.
- Reject the stream as soon as its first fragment fails JSON parsing.
- Merge fragments from every content block into a single JSON document.
- Accumulate fragments for the correct block, then parse and validate completed arguments before authorizing execution.
Explanation
Correct Answer
D:Each delta supplies part of a larger argument value. Reconstructing the block avoids acting on an incomplete request, while validation and authorization establish a boundary before the record-changing operation runs.
Incorrect Answers
A:A field name does not establish a complete argument set. Early execution may use partial values and repeat the external change as more fragments arrive.
B:Incremental JSON can be valid streaming behavior while remaining invalid in isolation. Rejecting a partial value confuses normal delivery with a malformed completed payload.
C:Block indices distinguish separate content streams. Mixing unrelated blocks can combine different invocations or text with arguments, corrupting otherwise valid requests.
Question 12
A batch contains extraction requests for independent documents. Downloaded results arrive in a different order from the submitted requests. Which approach preserves the correct document-to-result mapping?
- Pair inputs and results by their positions in the two lists.
- Join results to source records using each request’s unique custom_id.
- Match generated text to the source with the most similar title.
- Assign every request the same custom_id to identify the batch.
- Sort results by response length and documents by input length.
Explanation
Correct Answer
B:Batch scheduling does not provide an ordering guarantee for results. An application-controlled identifier preserves the relationship independently of completion order and also associates a failed request with its original document.
Incorrect Answers
A:This assumes the ordering guarantee that the observed results contradict. A plausible extraction could silently be attached to the wrong source document.
C:Similar documents and error results can defeat content-based matching. Explicit identifiers provide an unambiguous association without requiring guesses about the generated text.
D:One shared label cannot distinguish individual requests. A batch identifier and a per-request identity solve different correlation problems.
E:Generated length is not a unique function of input size. Sorting these different measurements creates a heuristic match rather than a dependable identity relationship.
Question 13
A backend sends the text “Inspect /tmp/receipt.png” to the Messages API. The image exists only on the backend’s disk, and Claude has no file-reading tool. What change provides the actual visual input?
- Put the image filename in the model field to select it as input.
- Tell Claude in the system prompt to open that local path directly.
- Include a supported image content block carrying the image data or a supported accessible reference.
- Increase max_tokens so Claude has enough capacity to load the image.
Explanation
Correct Answer
C:A local pathname is just text to the remote model. A documented image input representation makes the pixels available; accompanying text can then specify which receipt details to inspect.
Incorrect Answers
A:The model field selects the model to invoke. It is not a file-loading field, so substituting a pathname neither specifies a valid model nor supplies image content.
B:An instruction does not grant filesystem access. Without supplied image content or an appropriate execution tool, the API cannot retrieve a private file from a textual pathname.
D:The output allowance controls generation rather than input transfer. Increasing it cannot make bytes on the backend’s filesystem available to the model.
Question 14
A Python service classifies many independent messages without blocking unrelated work. Launching a task for every message overwhelms its tested concurrency budget. Which implementation preserves asynchronous I/O while bounding active requests?
- Use an async client with a queue or semaphore limiting in-flight calls.
- Add a blocking sleep before each call while keeping unlimited task creation.
- Launch all calls with gather and rely on async execution to enforce limits.
- Call the synchronous client directly inside every async handler.
Explanation
Correct Answer
A:Awaitable network I/O allows other tasks to run while a request waits. A concurrency control bounds simultaneous calls; separate request-rate or token-rate throttling may still be needed to meet the provider’s limits.
Incorrect Answers
B:Blocking sleep prevents the event loop from servicing unrelated work. It also fails to express a dependable bound on active calls.
C:Gather schedules awaitables but does not impose the application’s desired cap. Unbounded scheduling can reproduce the same burst that overwhelmed the service.
D:A synchronous network operation can block the event-loop thread. Declaring its caller async does not make that operation nonblocking or implement a concurrency limit.
Question 15
A request receives HTTP 429, rate_limit_error, and a Retry-After header. The application confirms temporary throughput throttling rather than an exhausted spending cap. Which recovery policy fits this evidence?
- Respect Retry-After, reduce request pressure, and apply bounded backoff with jitter.
- Have every worker immediately retry until a request succeeds.
- Rewrite the prompt because a 429 always indicates malformed content.
- Rotate API keys on every retry but keep organization traffic unchanged.
Explanation
Correct Answer
A:The service is sending work faster than its available throughput permits. Waiting as directed and reducing pressure addresses that condition, while retry bounds and jitter prevent a synchronized or unlimited retry burst.
Incorrect Answers
B:Immediate parallel retries add traffic where the system is already throttling. They can prolong failure rather than let the available budget recover.
C:Invalid request content is a different error class. The explicit throttling evidence calls for traffic management, not a task-changing prompt rewrite.
D:New credentials do not reliably change shared throughput limits. This creates credential churn without fixing the traffic pattern responsible for the error.
Question 16
A multitenant assistant stores history using only a browser-supplied session number. Two customers can submit the same number and retrieve each other’s messages. What is the primary application-design fix?
- Prefix the visible conversation title with the customer name but keep the lookup unchanged.
- Increase context capacity so the customers’ messages are easier to distinguish.
- Instruct Claude to ignore history from a different customer.
- Bind conversations to authenticated tenant and user identities and authorize every lookup.
Explanation
Correct Answer
D:The stored conversation needs an enforced ownership boundary. Resolving authenticated identity before retrieving history prevents a guessed or reused client value from selecting another customer’s data.
Incorrect Answers
A:A display label changes presentation, not authorization. The backend still retrieves the record selected by the untrusted session number.
B:Additional capacity does not establish ownership. It can expose more mixed history while retaining the same defective lookup mechanism.
C:Unauthorized data has already crossed the application boundary when Claude receives it. A prompt cannot undo that retrieval or replace the missing access check.
Question 17
An extraction schema permits any numeric discount percentage. Claude returns valid JSON with discount_percent set to 180, but the business permits only 0 through 100. What should happen before the record is accepted?
- Validate the business range and reject or route invalid values for correction.
- Silently replace 180 with 100 and mark the extraction verified.
- Accept it because any schema-valid number is a valid discount.
- Convert the value to a string so numeric limits no longer apply.
Explanation
Correct Answer
A:Parseable JSON and a numeric type do not establish business validity. The application must enforce the allowed range before use and should encode supported constraints in its schema to reduce invalid generations.
Incorrect Answers
B:Clamping invents an accepted value without evidence that 100 was intended. A correction policy must be explicit; silent alteration is not verification.
C:The specified schema checks a broad type rather than the business range. Equating those guarantees admits a structurally valid but unusable value.
D:Changing the type does not repair the invalid discount. It may also violate the consuming code’s expected interface while preserving the erroneous value.
Question 18
A service already has a tool dispatcher, retry policy, and conversation store. It needs typed Python access to Messages while retaining those components. Which integration is the closest fit?
- Replace orchestration with the full Agent SDK solely to obtain API transport.
- Use the official Python client SDK for direct Messages calls.
- Use an MCP server as a complete replacement for model invocation.
- Move prompts into Claude Code Skills and remove model API access.
Explanation
Correct Answer
B:The client library wraps API access without requiring replacement of existing orchestration. The service can keep ownership of its conversation state and tool execution decisions.
Incorrect Answers
A:An agent harness is useful when its built-in loop and tools are wanted. Adopting that broader abstraction just for transport changes responsibilities this service intends to retain.
C:An MCP server exposes capabilities or context to clients. It does not automatically take over this application’s model requests and conversation orchestration.
D:Skills package reusable instructions and related resources. They do not themselves provide direct Messages transport for the existing Python service.
Question 19
An evaluation record says only “a Sonnet model” and points to a prompt that is continually edited. Which configuration record would most improve the team’s ability to reproduce the evaluated setup?
- Record the timestamp and discard the actual prompt revision.
- Record only whether the ID contains a date because all dateless IDs change automatically.
- Record only the family name because all releases in that family behave identically.
- Record the exact model release ID, prompt revision, tool-schema revision, and relevant request settings.
Explanation
Correct Answer
D:These values identify the components that shaped the run. Recording them lets the team reconstruct the setup and distinguish deliberate changes from drift, although fixed configuration does not guarantee identical stochastic outputs.
Incorrect Answers
A:A timestamp can correlate events but cannot reconstruct an edited prompt. The inputs and interface revisions remain necessary to recover the tested configuration.
B:That assumption is outdated. From the 4.6 generation onward, dateless canonical IDs identify fixed snapshots; the exact documented release matters more than the presence of a date suffix.
C:A family label is not a complete release identifier. Model updates and prompt or tool changes can alter behavior while that broad label remains unchanged.
Question 20
All repository contributors should receive the same concise build commands and coding conventions in Claude Code. The team wants to review changes to these instructions in version control. Where should they be maintained?
- As arbitrary prose entries in settings.json instead of an instruction file.
- In a project CLAUDE.md committed with the repository.
- Only in one developer’s ~/.claude/CLAUDE.md.
- Only in an untracked personal note outside the repository.
Explanation
Correct Answer
B:Project instructions travel with the code and can be reviewed alongside it. This provides shared behavioral context for commands and conventions that should apply to contributors working on that project.
Incorrect Answers
A:Settings configure supported client behavior through a defined schema. They are not a general-purpose replacement for project prose; unrecognized entries do not establish the intended shared guidance.
C:The user-level file applies to that developer’s environment. It does not automatically distribute the repository’s conventions to teammates through version control.
D:A local note may help its author, but other contributors may not receive it or subsequent updates. It cannot serve as the requested shared, reviewed instruction source.