# Claude API Mechanics — Practice reading

Exam: CCDV-F — Claude Certified Developer - Foundations
Knowledge domain: Applications and Integration
HTML: https://learningpathx.com/learning-path/CCDV-F/learn/409

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: Messages, tools, and streaming

For a high-volume workload that does not need an immediate response, which two characteristics identify the Claude Message Batches API? (Choose 2.)

### Options

**A**

It requires every request to share one identical custom\_id.

**B**

It is the synchronous conversational endpoint at POST /v1/messages.

**C**

It processes requests asynchronously using bulk capacity.

**D**

It offers a 50% cost reduction for asynchronous processing.

Correct answer: C, D

### Explanation

Batch processing is designed for high-throughput, non-latency-sensitive asynchronous work. Batches asynchronously process bulk nonurgent requests. The batch API provides the documented cost reduction for asynchronous processing. Documented batch request processing offers50% cost reduction. The stated discount is the documented batch-processing token-price benefit; it is not a guarantee of dedicated compute or immediate completion.

## Question 2

Type: single\_choice
Knowledge point: Messages, tools, and streaming

While consuming a streamed Claude Messages API response, which Server-Sent Event indicates that the server will send no further events on the connection?

### Options

**A**

message\_delta

**B**

message\_stop

**C**

content\_block\_delta

**D**

content\_block\_start

Correct answer: B

### Explanation

This event concludes the SSE session. message\_stop marks the end of the normal message stream. This describes normal completed streaming; exceptional errors or premature disconnects must be handled separately.

## Question 3

Type: single\_choice
Knowledge point: Messages, tools, and streaming

Which statement correctly distinguishes a server tool from a client-side tool in a Claude API integration?

### Options

**A**

A client-side tool can be called only after the response stream ends, whereas a server tool cannot be used with streaming.

**B**

A server tool must be declared with a local subprocess command, whereas a client-side tool needs no schema.

**C**

A client-side tool is automatically authorized to execute any returned arguments without application checks.

**D**

A server tool runs on Anthropic infrastructure, whereas a client-side tool is executed by the application's own integration.

Correct answer: D

### Explanation

* A. Tool execution mode is not defined by that streaming restriction.
* B. Client-side tools still need clear definitions and their execution is not a server-tool subprocess requirement.
* C. Application-side execution retains responsibility for validating and authorizing tool input.
* D. Server tools execute on Anthropic infrastructure; client-side tool calls are handled by the application.

## Question 4

Type: single\_choice
Knowledge point: Messages, tools, and streaming

A direct Claude Messages API stream starts a client-tool block at index 1\. These are the only argument fragments received so far:

```text
content_block_start: index=1, type=tool_use, id=toolu_check, name=check_stock
content_block_delta: index=1, type=input_json_delta, partial_json={"sku":"AB
content_block_delta: index=1, type=input_json_delta, partial_json=12"}
```

The application allows execution only after that tool block closes and its complete input passes the local schema. What should it do at this point?

### Options

**A**

Execute check\_stock because the concatenation currently parses

**B**

Wait for content\_block\_stop at index 1, then parse and validate the accumulated input

**C**

Parse each fragment as an independent request and execute both

**D**

Treat a ping event as closure of the tool block

Correct answer: B

### Explanation

Input JSON deltas are fragments of a block input, not separate calls. The stream has not yet supplied the block-stop event required by this application, so a currently parseable concatenation is insufficient for dispatch.

## Question 5

Type: multiple\_choice
Knowledge point: Messages, tools, and streaming

Which statements accurately describe events in a Claude API Server-Sent Event stream? (Choose 3.)

### Options

**A**

A content\_block\_delta can contain partial tool input JSON in an input\_json\_delta.

**B**

A message\_delta can report a stop reason and total output token metrics.

**C**

Streaming sends the complete response as one final event before any content-block events.

**D**

A message\_stop marks the end of the stream.

Correct answer: A, B, D

### Explanation

input\_json\_delta supplies fragments of tool input JSON; accumulate the fragments for the block before parsing and validating the completed object. message\_delta carries final message-level state including stop reason and output usage. message\_delta reports message stop state and cumulative usage. message\_stop concludes the SSE session. message\_stop completes the stream.

## Question 6

Type: single\_choice
Knowledge point: Messages, tools, and streaming

A direct Claude Messages API stream for one response emits these message-level updates before its final message\_stop:

```json
{"type":"message_delta","usage":{"output_tokens":8}}
{"type":"message_delta","usage":{"output_tokens":11}}
```

No fallback or second message occurs. The application wants this response's final reported output-token count. What should it record?

### Options

**A**

19, because message\_delta usage values are per-event increments

**B**

11, because the reported usage values are cumulative

**C**

8, because only the first usage update belongs to the message

**D**

0, because usage is unavailable until another request is sent

Correct answer: B

### Explanation

The documented usage in message\_delta is cumulative. The later value is the running total for this response, so summing the two updates would double-count earlier output.

## Question 7

Type: single\_choice
Knowledge point: Vision and thinking

For a direct Claude Messages API request to an enabled vision-capable model, a developer has base64 bytes produced from a valid PNG file. The image must be supplied in a user message with a text question. Which content array uses the documented image-input structure? Assume the image is within the endpoint limits.

### Options

**A**

\[{"type":"text","text":"data:image/png;base64,<bytes>"}\]

**B**

\[{"type":"image","source":{"type":"base64","media\_type":"image/jpeg","data":"<PNG bytes>"}},{"type":"text","text":"What is shown?"}\]

**C**

\[{"type":"image","source":{"type":"base64","media\_type":"image/png","data":"<PNG bytes>"}},{"type":"text","text":"What is shown?"}\]

**D**

\[{"type":"image","data":"<PNG bytes>"},{"type":"text","text":"What is shown?"}\]

Correct answer: C

### Explanation

The image content block contains a source object identifying base64 data and the matching image/png media type. A separate text block supplies the question; merely writing a data URI as text does not use that image-block structure.

## Question 8

Type: single\_choice
Knowledge point: Vision and thinking

On a supported Claude model with extended thinking enabled and a display mode that streams visible thinking text, where can the application receive its incremental thinking content?

### Options

**A**

In a thinking\_delta carried by a content\_block\_delta event

**B**

In the custom\_id field of a Message Batch result

**C**

Only in the HTTP request headers before model execution

**D**

Only in the message\_stop event after the stream has closed

Correct answer: A

### Explanation

Thinking blocks deliver incremental content through thinking\_delta payloads in content-block delta events. Displayed thinking streams as thinking\_delta in content\_block\_delta. Visible thinking may be summarized and is not the model’s complete private reasoning; omitted-thinking display modes may emit no thinking text.

## Question 9

Type: multiple\_choice
Knowledge point: Vision and thinking

Before sending a supported Claude Messages request containing a base64 image and accompanying text, which two outcomes can the Token Counting API support? (Choose 2.)

### Options

**A**

Estimating the payload's input token usage before generation

**B**

Streaming the final model response through thinking\_delta events

**C**

Comparing estimated image-and-text input usage with the model’s context capacity while reserving room for output

**D**

Returning the individual results of an asynchronous Message Batch

Correct answer: A, C

### Explanation

Token Counting estimates supported image-and-text input usage for the selected model, enabling a context-budget preflight with output space reserved. It does not generate the response or predict its eventual output length.

## Question 10

Type: single\_choice
Knowledge point: Caching and third-party vendor invocation

Without a separate explicit Anthropic approval to use consumer credentials, which offered credential is permitted for a third-party application invoking the Anthropic developer API?

### Options

**A**

A standard Anthropic API key

**B**

A browser cookie copied from a Claude.ai session

**C**

A user's Claude.ai Free, Pro, or Max session token

**D**

A consumer subscription credential routed through an intermediary

Correct answer: A

### Explanation

API access may use a standard API key or configured Workload Identity Federation. A standard authorized API key permits developer API access. Supported workload-identity authentication may be another configured option, but it is not offered here.

## Question 11

Type: single\_choice
Knowledge point: Caching and third-party vendor invocation

When no ttl is specified, what is the default TTL for an Anthropic ephemeral prompt cache entry?

### Options

**A**

5 minutes

**B**

24 hours

**C**

30 seconds

**D**

1 hour

Correct answer: A

### Explanation

The default TTL for an ephemeral cache entry is five minutes and is refreshed on a cache hit. Default minimum lifetime is5minutes and refreshes on use. This is the documented minimum lifetime measured from request start and refreshed on use; a configured one-hour TTL is a different option.

## Question 12

Type: multiple\_choice
Knowledge point: Caching and third-party vendor invocation

Which two prompt-design practices help a Claude prompt cache create and reuse a stable prefix? (Choose 2.)

### Options

**A**

Change the contents of the cached prefix for every request.

**B**

Put static system prompts and tool definitions before dynamic request-specific values.

**C**

Ensure the total cacheable prefix meets the documented minimum token threshold for the selected model/platform.

**D**

Put timestamps and request IDs at the start of the cached prefix.

Correct answer: B, C

### Explanation

A qualifying unchanged prefix through the cache marker can be reused. Put variable content after that marker, keep the API’s tools/system/messages hierarchy, and meet the model/platform’s total minimum prefix size.

## Question 13

Type: single\_choice
Knowledge point: Caching and third-party vendor invocation

Which cache\_control type marks a Claude system-prompt block for the documented short-lived prompt cache?

### Options

**A**

ephemeral

**B**

immutable

**C**

persistent

**D**

background

Correct answer: A

### Explanation

The prompt caching example uses cache\_control: {"type": "ephemeral"}. Ephemeral is the documented cache\_control type.

## Question 14

Type: multiple\_choice
Knowledge point: Caching and third-party vendor invocation

During a controlled repeated-request test, which two actions or checks help diagnose and improve reuse of a static Claude prompt prefix? (Choose 2.)

### Options

**A**

Move request-specific identifiers after the cache breakpoint.

**B**

Put each user's timestamp at the start of the system prompt.

**C**

Verify that cache-read token usage is greater than zero on a reuse check.

**D**

Replace all static tool definitions with dynamically generated text each turn.

Correct answer: A, C

### Explanation

Request-specific data must follow the reusable static prefix. Moving identifiers after breakpoint preserves exact reusable prefix. Cache-read token usage is evidence that the cache has been reused. Positive cache\_read\_input\_tokens confirms actual prefix reuse. Compare requests with the same eligible marked prefix; a positive cache\_read\_input\_tokens value proves reuse for that check, not a guarantee of every future hit.

## Question 15

Type: single\_choice
Knowledge point: Caching and third-party vendor invocation

An application must invoke Claude Opus 4.6 through the legacy Amazon Bedrock integration, not the newer Bedrock Messages endpoint. The deployment record specifies Python 3.11 and anthropic\[bedrock\] 1.13.0\. Its default AWS credential provider resolves the intended temporary AWS identity, and the region is us-west-2\. In this case the administrator has separately confirmed that this identity may invoke the available inference profile global.anthropic.claude-opus-4-6-v1; base-model on-demand invocation is not enabled. No direct Claude API key or Bedrock bearer token is configured, and no custom base URL is set. These are stipulated deployment facts, not results of constructing a client. Every candidate below would call client.messages.create(model=MODEL, max\_tokens=64, messages=\[{"role":"user","content":"Reply with READY."}\]). Which client and MODEL configuration matches the declared provider, identity and invocation route?

### Options

**A**

from anthropic import Anthropic client = Anthropic(api\_key="AWS-IDENTITY-PLACEHOLDER") MODEL = "claude-opus-4-6"

**B**

from anthropic import AnthropicBedrock client = AnthropicBedrock(aws\_region="us-west-2") MODEL = "anthropic.claude-opus-4-6-v1"

**C**

from anthropic import AnthropicBedrock client = AnthropicBedrock(aws\_region="us-west-2") MODEL = "global.anthropic.claude-opus-4-6-v1"

**D**

from anthropic import AnthropicBedrock client = AnthropicBedrock(api\_key="DIRECT-CLAUDE-KEY-PLACEHOLDER", aws\_region="us-west-2") MODEL = "global.anthropic.claude-opus-4-6-v1"

Correct answer: C

### Explanation

Use the Bedrock client with resolved AWS identity, the declared region and the permitted profile. Client construction does not establish model access.

## Question 16

Type: single\_choice
Knowledge point: Messages API data access patterns

With tool\_choice.type set to auto on a compatible Claude Messages model, which nested tool\_choice setting restricts a response to zero or one tool call?

### Options

**A**

max\_tokens: 0

**B**

disable\_parallel\_tool\_use: true

**C**

stream: False

**D**

processing\_status: ended

Correct answer: B

### Explanation

Use tool\_choice with type:auto and disable\_parallel\_tool\_use:true to allow at most one tool call in the response. Streaming and output-token limits do not set tool-call concurrency.

## Question 17

Type: single\_choice
Knowledge point: Messages API data access patterns

Which endpoint is the primary Claude API endpoint for conversational interactions?

### Options

**A**

POST /v1/messages/count\_tokens

**B**

POST /v1/messages

**C**

GET /v1/models

**D**

POST /v1/messages/batches

Correct answer: B

### Explanation

The Messages API is accessed through POST /v1/messages for conversational interactions. POST /v1/messages generates the next conversational message.

## Question 18

Type: multiple\_choice
Knowledge point: Messages API data access patterns

Which four fields are accepted in a supported Claude Token Counting API request? (Choose 4.)

### Options

**A**

model

**B**

thinking

**C**

tools

**D**

messages

**E**

A Message Batch custom\_id correlation field

Correct answer: A, B, C, D

### Explanation

Token counting accepts the model selection field. Model selects the tokenizer/model for the input estimate. It also accepts the thinking parameter. thinking configuration is accepted in supported token-counting requests. It accepts tool definitions in the request payload. tools accepts supported tool definitions, not every server/MCP feature. It accepts the conversation messages field. messages supplies conversation content to count. The request uses supported Messages-style input elements but does not support every Messages feature or input-source variant; consult the Token Counting contract.

## Question 19

Type: multiple\_choice
Knowledge point: Messages API data access patterns

Which two characteristics apply to an Anthropic-provided server tool such as web search? (Choose 2.)

### Options

**A**

It runs on Anthropic infrastructure.

**B**

The client application must always launch a local subprocess to execute it.

**C**

It can return cited results directly in the response.

**D**

It cannot be included in a Messages API tools list.

Correct answer: A, C

### Explanation

* A. Anthropic executes server tools on its own infrastructure.
* B. Local subprocess execution describes a different integration pattern.
* C. Server-tool output can include cited results in the model response.
* D. Server tools are declared in the request's tools configuration.

## Question 20

Type: single\_choice
Knowledge point: Messages API data access patterns

When handling a client-side tool call from a Claude response, what should the application extract from the tool\_use content block?

### Options

**A**

Only the final output token total

**B**

The API key used for the request

**C**

The server's retry-after header

**D**

The tool name and input arguments

Correct answer: D

### Explanation

Client tool handling reads the selected tool's name and structured input arguments. name selects the tool and input supplies arguments; keep id for the result association. For a complete result round trip, retain tool\_use.id for tool\_result correlation and validate arguments and authorization before execution; name and input identify the requested operation.

## Question 21

Type: multiple\_choice
Knowledge point: Messages API data access patterns

Which two request elements are used when an application invokes the Claude Messages API through the SDK? (Choose 2.)

### Options

**A**

A previously returned retry-after response header

**B**

A model identifier

**C**

A completed batch's processing\_status

**D**

A messages collection

Correct answer: B, D

### Explanation

A Messages request selects the target model. Model selects the model completing the prompt. The request includes conversation messages. messages provides the conversation input. These are two accepted request elements; a complete ordinary Messages request also needs its required output budget such as max\_tokens, which is not offered here.

## Question 22

Type: single\_choice
Knowledge point: Batch API use and realtime tradeoffs

A direct Claude API application has two evaluated workloads using enabled text-output models. The online assistant must show incremental text feedback within two seconds; a trial with Messages streaming met that bound. The offline job has 300 independent summarization requests and can wait up to 24 hours for results. Which routing plan follows the documented processing contracts and these requirements?

### Options

**A**

Use Message Batches for both and treat batch-result download as live token feedback

**B**

Use ordinary completed Messages responses for both and ignore incremental feedback

**C**

Use Messages streaming for the online assistant and Message Batches for the independent offline requests

**D**

Use one batch member for both workloads so the online result depends on all offline summaries

Correct answer: C

### Explanation

Messages streaming provides incremental response events, while Message Batches is asynchronous bulk processing with results available after processing. The demonstrated streaming path fits the interactive deadline; the independent offline workload can use the later batch-result lifecycle.

## Question 23

Type: multiple\_choice
Knowledge point: Batch API use and realtime tradeoffs

Which two API choices support different timing requirements for Claude workloads? (Choose 2.)

### Options

**A**

Use Token Counting to return tool-use results to an interactive user.

**B**

Use Streaming Messages for incremental real-time feedback.

**C**

Use a completed batch status as a replacement for a streamed response.

**D**

Use Message Batches for non-latency-sensitive bulk processing.

Correct answer: B, D

### Explanation

* A. Token counting measures a request; it does not generate tool-use output.
* B. Streaming delivers incremental content over server-sent events.
* C. Completion status is not an interactive delivery channel.
* D. Batches provide asynchronous bulk capacity for suitable workloads.

## Question 24

Type: single\_choice
Knowledge point: Batch API use and realtime tradeoffs

Which batch processing status indicates that results can be streamed and parsed?

### Options

**A**

archived

**B**

ended

**C**

canceling

**D**

in\_progress

Correct answer: B

### Explanation

The example retrieves results when processing status is ended. Ended means all requests finished and results are ready.

## Question 25

Type: multiple\_choice
Knowledge point: Batch API use and realtime tradeoffs

Which two workload characteristics make the Message Batches API a better fit than real-time streaming? (Choose 2.)

### Options

**A**

The client must receive a thinking\_delta immediately.

**B**

Each response must appear incrementally to an interactive user.

**C**

The workload is not latency sensitive.

**D**

The workload is high volume.

Correct answer: C, D

### Explanation

They are intended for asynchronous, non-latency-sensitive workloads. Delay-tolerant workloads can await asynchronous processing. Message Batches are designed for high-throughput processing. Batching is designed for high-volume request processing. This is a workload fit decision, not a hard latency or completion-time guarantee.

## Question 26

Type: single\_choice
Knowledge point: Batch API use and realtime tradeoffs

In the Python Anthropic SDK, after creating a Message Batch whose identifier is stored in batch.id, which operation retrieves its current processing state?

### Options

**A**

client.messages.batches.retrieve(batch.id)

**B**

client.tools.execute(batch.id)

**C**

client.messages.stream(batch.id)

**D**

client.messages.count\_tokens(batch.id)

Correct answer: A

### Explanation

The batch retrieve operation returns processing status and request counts. messages.batches.retrieve(batch.id) returns batch processing\_status/request counts.

## Question 27

Type: single\_choice
Knowledge point: Batch API use and realtime tradeoffs

Which Message Batch result field lets a client correlate a returned result with the original submitted request?

### Options

**A**

thinking\_delta

**B**

processing\_status

**C**

retry-after

**D**

custom\_id

Correct answer: D

### Explanation

* A. Thinking deltas belong to streamed Messages responses.
* B. Processing status describes a batch state rather than an individual request correlation key.
* C. Retry-after is a rate-limit response header.
* D. The client supplies custom\_id values to correlate requests with returned batch results.

