{ "title": "Building with the Claude API: knowledge check", "description": "A 12-question multiple-choice check for developers who have just finished an intro course on the Claude Messages API. Demo content written for this project.", "items": [ { "id": "Q01", "objective": "Recognize when output was cut off by the token limit", "stem": "A response stops mid-sentence. Which stop_reason tells you the output hit the max_tokens limit you set?", "options": { "A": "end_turn", "B": "max_tokens", "C": "stop_sequence", "D": "tool_use" }, "key": "B" }, { "id": "Q02", "objective": "Continue a tool-use loop correctly", "stem": "Claude replies with stop_reason \"tool_use\". What should your code do next?", "options": { "A": "Send the exact same request again", "B": "Run the requested tool and send the output back as a tool_result block in a new user message", "C": "Paste the tool output into the system prompt and start a new conversation", "D": "Treat it as an error and retry with a higher max_tokens" }, "key": "B" }, { "id": "Q03", "objective": "Return parallel tool results correctly", "stem": "In one turn, Claude asks for three different tool calls. How should you return the three results?", "options": { "A": "Three separate user messages, one result in each", "B": "One user message that holds all three tool_result blocks", "C": "Only the first result, since Claude will ask for the others again", "D": "One assistant message that holds all three results" }, "key": "B" }, { "id": "Q04", "objective": "Report a failed tool call to Claude", "stem": "One of your tools throws an exception while running. What is the recommended way to tell Claude?", "options": { "A": "Leave the tool_result out so Claude moves on", "B": "Return a tool_result with is_error set to true and a short description of what went wrong", "C": "Return an HTTP 500 from your app so the SDK retries", "D": "Start a new conversation without the tool" }, "key": "B" }, { "id": "Q05", "objective": "Place the main system prompt in a request", "stem": "Where does the main system prompt go in a Messages API request?", "options": { "A": "In the messages array, as a message with role \"system\"", "B": "In the top-level system parameter", "C": "In the metadata field of the first user message", "D": "In a custom request header" }, "key": "B" }, { "id": "Q06", "objective": "Explain why a prompt cache misses", "stem": "You add the current timestamp to the very top of your system prompt, and your cache hit rate drops to zero. Why?", "options": { "A": "Cached prompts expire every 60 seconds", "B": "Caching is a prefix match, so a change near the start invalidates everything after it", "C": "Timestamps are not allowed in system prompts", "D": "Caching only applies to tool definitions" }, "key": "B" }, { "id": "Q07", "objective": "Verify that caching is working", "stem": "How can you confirm that a cached prefix was actually reused on a request?", "options": { "A": "Check usage.cache_read_input_tokens in the response", "B": "Compare response times and assume faster means cached", "C": "Check whether stop_reason is \"cached\"", "D": "Look for a [cached] marker at the start of the response text" }, "key": "A" }, { "id": "Q08", "objective": "Get output that always matches a JSON schema", "stem": "Your app needs Claude's answer to match a JSON schema every time. What is the most reliable option?", "options": { "A": "Add \"respond only in JSON\" to the end of the prompt", "B": "Use structured outputs, for example output_config.format or messages.parse in the SDK", "C": "Parse the reply with a regular expression and retry on failure", "D": "Give three JSON examples in the system prompt" }, "key": "C" }, { "id": "Q09", "objective": "Guarantee schema-valid tool inputs", "stem": "You want every tool call's input to validate exactly against that tool's input_schema. What do you set?", "options": { "A": "strict: true on the tool definition", "B": "strict: true inside tool_choice", "C": "A higher max_tokens value", "D": "A json-mode request header" }, "key": "A" }, { "id": "Q10", "objective": "Interpret a 429 response", "stem": "Your app starts getting HTTP 429 responses. What do they mean, and what is the right response?", "options": { "A": "The API key is invalid, so rotate it", "B": "You hit a rate limit, so back off and retry (the SDKs retry with exponential backoff)", "C": "The request body is too large, so split it", "D": "The model has been retired, so switch models" }, "key": "B" }, { "id": "Q11", "objective": "Decide which errors to retry", "stem": "Which of these errors is NOT worth retrying automatically without changing the request?", "options": { "A": "429 rate_limit_error", "B": "529 overloaded_error", "C": "500 api_error", "D": "400 invalid_request_error" }, "key": "D" }, { "id": "Q12", "objective": "Match batch results to requests", "stem": "You submit 1,000 requests through the Message Batches API. How should you match each result to its request?", "options": { "A": "By position, since results come back in the order you sent them", "B": "By the custom_id you gave each request", "C": "By the timestamp on each result", "D": "By input token count, since results are sorted by size" }, "key": "B" } ] }