Flashcardsfor IT Certifications

D2: Streaming Responses

Claude Certified Developer – Foundations exam practice questions · 10 flashcards

Question
How do you enable streaming?
1 / 10

Tip: Space flips the card, ← / → navigate.

Last updated: · Report an error on this page

Show all 10 Streaming Responses practice questions and answers
  1. How do you enable streaming?
    Set stream: true (or use the SDK's stream helper).
  2. Which protocol does Messages API streaming use?
    Server-sent events (SSE) over HTTP.
  3. What is the order of streaming events?
    message_start → content_block_start → content_block_delta(s) → content_block_stop → message_delta → message_stop.
  4. Which event carries the generated text pieces?
    content_block_delta (with text_delta, or input_json_delta for tool inputs).
  5. Where do you find the final stop_reason and output usage in a stream?
    In the message_delta event.
  6. Why stream responses in a chat UI?
    Users see text immediately, improving perceived latency.
  7. Why stream long or high max_tokens requests?
    To avoid HTTP timeouts; SDKs require streaming for requests that may take very long.
  8. How do tool inputs arrive while streaming?
    As partial JSON strings (input_json_delta) you accumulate until the block stops.
  9. How should a stream error mid-response be handled?
    Catch the error event, decide whether to retry, and don't treat the partial output as complete.
  10. Does streaming reduce cost?
    No. Token cost is the same; it improves responsiveness, not price.