D2: Asynchronous Programming
Claude Certified Developer – Foundations exam practice questions · 10 flashcards
Question
Why use async code with the Claude API?
1 / 10
Tip: Space flips the card, ← / → navigate.
Show all 10 Asynchronous Programming practice questions and answers
- Why use async code with the Claude API?API calls are I/O-bound; async lets many requests run concurrently without blocking.
- Which Python client supports async?AsyncAnthropic, used with await.
- How do you run several Claude calls concurrently in Python?Use asyncio.gather (or task groups) on multiple async calls.
- How do you avoid hitting rate limits with concurrency?Cap concurrent requests (e.g. a semaphore) and back off on 429s.
- What does async look like in TypeScript?The SDK returns Promises; use async/await and Promise.all for concurrency.
- Why not block the event loop?A blocking call freezes all other work in an async server.
- How does async relate to streaming?Streams are consumed asynchronously, event by event.
- Async concurrency vs Batch API?Async: fast, full price. Batch: slower (up to 24h), cheaper.
- How should exceptions in concurrent tasks be handled?Catch per-task errors so one failure doesn't lose all results; retry failed items.
- What is a job queue pattern?Requests go into a queue processed by workers, smoothing load and enabling retries.