Domain 4 · 20% of exam · 12 of 60 items
Prompt Engineering & Structured Output practice questions
83 questions drawn from this domain’s 6 task statements, untimed and in order. Every option carries its own explanation, so a question you get right for the wrong reason still tells you something.
Worked exampleOne question, solved step by stepShow
Structured Data Extraction · Task 4.3
Your contract extractor fills a governing_law enum (England and Wales, New York, Delaware, Other). Some contracts name two jurisdictions for different clauses, and the extractor confidently picks one, which legal review later finds wrong in about half those cases. What schema change would most effectively address this?
- A.Make governing_law nullable, so the extractor can return null whenever the governing law is not clear from the text.
- B.Add an "unclear" enum value with a short explanation field, and route those contracts to legal review automatically.
- C.Add a prompt rule telling the extractor to choose the jurisdiction that governs the majority of the contract's clauses.
- D.Add an enum value for every pair of jurisdictions seen so far, so that split-law contracts have a category of their own.
Working it through
- 1. What is being asked. A schema change for documents whose answer is genuinely ambiguous, not missing.
- 2. The constraint that decides it. The information is present but conflicting, and the schema forces a single confident value. The errors come from making the model choose when the right output is to say it cannot.
- 3. Predict before reading the options. Give ambiguity its own explicit value, with room to explain, so these cases can be routed rather than guessed.
- 4. Rule out the near-misses.
- A — Null means the information is absent. Here it is present but ambiguous, so downstream systems would treat a split-law contract like one that names no law at all.
- C — Replaces one guess with a counting rule. It is still a confident single value for a legal question that needs a person.
- D — The list of combinations grows without limit, and it still records nothing about which clauses each law governs.
- 5. Answer: B. Nullable is for absent, "unclear" is for ambiguous, and "other" plus detail is for categories you didn't anticipate. Read the stem for which one you have.
Domain 4 drill
Question 1 of 83
Scenario · Claude Code for Continuous Integration
Your CI reviewer's prompt says "Check that error handling is appropriate." It flags every catch block that does not log, including deliberate ones inside the retry helper and in tests that assert on exceptions. Developers dismiss 60% of its error-handling findings, and two teams have started ignoring the bot. What change would most effectively improve precision?
Getting value out of these
Read every explanation, including on the questions you answered correctly. The exam is a judgement test: the distractors are all things a working engineer has actually tried, and the reason each one fails is the material. A right answer picked for the wrong reason will not survive a differently worded question.
When you get one wrong, the useful question is not what the right answer was but whether you reached for a workaround over a mechanism — a bigger context window instead of less context, an instruction in the prompt instead of a constraint in the orchestration layer. That pattern repeats across the whole exam, and noticing it is worth more than memorising any single item.
These are untimed on purpose. Pace is a separate skill and belongs in the timed mock exam, where 60 items in 120 minutes gives you roughly two minutes each on questions that take real reading.
Where these questions come from
Each task statement’s lesson explains the material the questions test.
All 83 questions in this set
The scenarios and decisions this drill covers. Answers and explanations appear only when you work through the questions above.
Show the question list
- Your CI reviewer's prompt says "Check that error handling is appropriate." It flags every catch block that does not log, including deliberate ones inside the retry helper and in tests that assert on exceptions. Developers dismiss 60% of its error-handling findings, and two teams have started ignoring the bot. What change would most effectively improve precision?
- Your contract extractor lists "risky clauses" for the legal team. After complaints about noise, you added "Only report clauses that are truly risky; when unsure, leave them out." The next 200 contracts show the same false-positive rate, and two uncapped-liability clauses were missed. What change would most effectively improve the results?
- Your CI reviewer launched a naming-conventions category last month, and 70% of its findings are dismissed. Over the same period, the dismissal rate for security findings, which reviewers have confirmed are accurate, rose from 10% to 45%. You need several weeks to rewrite the naming criteria. What should you do in the meantime?
- A review step checks each extracted insurance claim and lists "issues" for adjusters. Most listed issues are date-style differences that the pipeline already normalises, while real problems, such as a policy number that does not match the policy holder, are buried among them. A teammate proposes keeping only issues the model rates at 0.9 confidence or above. What should you do instead?
- Your reviewer labels findings critical, major or minor using one-sentence definitions. Across runs, a SQL injection and a missing docstring have both been labelled major, and the same unchecked null is critical in one run and minor in the next. The team has twice added adjectives to the definitions. What change would most effectively make severity consistent?
- Your extraction QA prompt says "Flag documents that break our QA guidelines (see the QA wiki)." The wiki defines eight precise conditions, but the model never sees it. QA flags vary from run to run, and reviewers say most flags cite reasons that are not in the guidelines. What change would most effectively improve this?
- Your reviewer is told to "check that comments are accurate". It flags dozens of comments per pull request for minor wording, outdated tense and missing detail, and developers dismiss the category wholesale. The team cares only about comments that would mislead a reader about behaviour. What change would most effectively improve precision?
- You disabled the "missing optional field" flag on your extraction QA after a 60% false-positive rate, and you have since rewritten its criteria. Operations wants it back on across all document types from Monday. You have 600 past documents whose correct outcomes are known. What should you do first?
- Your codebase deliberately uses early returns and small guard functions, an approved team idiom. The reviewer keeps flagging them as "complex control flow", about 40 comments a week, and developers have begun ignoring all its control-flow findings, including real ones. What change would most effectively address this?
- Your extraction QA prompt reads "Be thorough but careful, and flag anything that seems off." It flags formatting differences the pipeline already normalises, while missing two real cases where a total didn't match its line items. Which two changes should you make to the prompt? (Select two.)
- Your extractor sends any document it is "unsure about" to human review, and 40% of documents now reach the queue, most of them extracted correctly. Reviewers report that the real problems are illegible scan regions, conflicting values and amounts outside allowed ranges. What change would most effectively improve this?
- After complaints about noise, your team narrowed the security criteria to "report string concatenation that includes request parameters". False positives fell sharply, but last week the reviewer missed an injection built from a header value and another from a config file read at request time. What change would most effectively fix this?
- Your pipeline compares each contract with its signed amendment and is told to "flag any inconsistencies". It flags differences in date format, capitalisation and party-name spacing on nearly every pair, and reviewers missed a changed payment amount among 30 flags. What change would most effectively improve this?
- Your lab-report extractor fills reference_range correctly when the range sits beside the result, but returns null for about 30% of reports from two labs that print ranges in a footnote legend keyed by symbols. The prompt already says "reference ranges may appear anywhere in the report." What change would most effectively fix these nulls?
- Developers want every review comment to state the location, the issue, its severity and a suggested fix. The prompt lists these four parts in detail, yet comments vary between bullet lists and paragraphs, and about a third omit the fix. What change would most effectively make the comments consistent?
- Your freight-manifest extractor fills weight_kg. Manifests often say "approx. half a tonne" or "2 x 25 kg sacks", and the extractor returns figures such as 500.0 or 25 with no sign they were estimated; for "one pallet, weight TBC" it returned 400. What change would most effectively reduce these errors?
- Your reviewer decides whether a missing branch test is worth flagging. It is consistent on obvious gaps but inconsistent on defensive branches, such as the default case of an exhaustive switch or a guard that the type system already prevents. Its instructions describe both kinds of branch in general terms. What change would most effectively make these decisions consistent?
- Your reviewer flags every use of the any type. The team allows any at JSON parsing boundaries when the value is narrowed immediately, and a rule saying "allow any in adapter files" has not helped, because adapters are not named consistently. What change would most effectively reduce these false positives without hiding real problems?
- Your research-paper extractor misses sample_size when the figure appears in the results text instead of a methods section, and returns an empty citations list for papers that use numbered inline references. The prompt already describes both situations. Which two changes should you make? (Select two.)
- Your reviewer can post_inline_comment on a specific line or post_summary_comment on the whole pull request. For issues that span several files, such as an interface change breaking callers, it picks inconsistently, and instructions describing both tools have not helped. What change would most effectively make its choices consistent?
- Your extractor fills vendor_tax_id on every invoice. About 15% of invoices genuinely carry no tax ID, yet the extractor returns plausible-looking values for them, some copied from the customer's own tax ID printed elsewhere on the page. The field is already nullable. What change would most effectively reduce these invented values?
- Your reviewer's four examples are all Python, and it now handles Python bugs well. The repository is half Go, and on Go code it either misses the same classes of issue or flags idiomatic error handling as bugs. What change would most effectively improve its Go reviews?
- Your extraction prompt now holds 14 examples, one added after every reported error over the past year. Latency has risen, accuracy on new document layouts has stopped improving, and the extractor copies values from examples that superficially resemble the input. What change would most effectively improve this?
- Your extractor classifies documents as invoice or credit_note, and its examples show inputs and labels only. Some genuinely corrected invoices carry negative totals under an "Invoice" heading. On such documents the label flips between runs, and finance needs it consistent. What change would most effectively stabilise these decisions?
- Your review prompt says style issues are always minor. One of its three few-shot examples, added months ago, labels a naming inconsistency as major. The reviewer now labels naming issues major about half the time, contradicting the instruction. What change would most effectively fix this?
- Your schema renamed amount to total_amount and dropped the notes field last month. The prompt's three examples still show the old fields. About one extraction in ten now includes a notes field or uses amount, and validation rejects them. What change would most effectively fix this?
- Some suppliers show discounts as negative line items, and others show them in a separate discount column. Your extractor double-counts discounts on the second layout, recording each as a line and as an adjustment, so totals come out too low. What change would most effectively fix this?
- Your receipt pipeline sends one tool, extract_receipt, with tool_choice set to auto. About 3% of responses contain only text, such as "This appears to be a restaurant receipt for £42.10", with no tool call, and the pipeline crashes on them. The model you run supports forced tool use. What change would most effectively guarantee a structured result?
- Your review job returns findings through a strict JSON schema, so every response parses. Even so, some findings cite line numbers outside the diff, name files the pull request does not touch, or mark a comment typo as critical. The team had assumed the schema guaranteed correct findings. What change would most effectively address this?
- Your expense extractor's category enum has travel, meals, software and office. Conference fees and cloud credits are forced into software or office, distorting the monthly reports, and finance adds new expense types every quarter. What schema change would most effectively handle this?
- Your CI job summarises one artefact per run, which may be a test-failure log, a lint report or a coverage report. Each type has its own extraction tool, and the job does not know in advance which type it has. With tool_choice set to auto, about one run in twenty returns a prose summary instead of a tool call. What change would most effectively guarantee structured output?
- Your contract pipeline offers three tools in one request: extract_parties, extract_obligations and lookup_registry, which needs a party's company number. In about 8% of runs Claude calls lookup_registry first, with a company number it has guessed, and the registry returns the wrong company. The model you run supports forced tool use. What change would most effectively prevent this?
- Your supplier invoices write dates as 03/04/2026, 4 Mar 26 or 2026-03-04, and some suppliers are American. The strict schema requires a date string, so every value is well formed, but about 6% of dates have day and month swapped, which pushes payments into the wrong week. What change would most effectively fix this?
- After moving to a newer model, every extraction request that forces the extract_invoice tool fails with a 400 error, because this model rejects forced tool use, both any and a named tool. You still need every response to be a JSON object matching your invoice schema, and no tool action is involved. What change would most effectively achieve this?
- Your shipping-document schema makes delivery_date a required string. About a fifth of documents have no delivery date, yet every extraction has one, and spot checks show the date on those documents is often copied from the issue date. What schema change would most effectively address this?
- Your review schema has severity: critical, major or minor. For some findings the impact depends on production configuration the diff does not show, and the reviewer forces them into minor or critical, which reviewers find wrong about half the time. What schema change would most effectively address this?
- Your review job forces a report_findings tool with tool_choice, and the model supports forced tool use. Every response calls the tool, but about 1% of calls omit a required field or add a property the schema doesn't define, and the poster crashes on them. strict is not set on the tool definition. What change would most effectively fix this?
- Your CI pipeline has two steps. Step 1 summarises an artefact with whichever of two summary tools fits, and must never return prose. Step 2 must run extract_metadata before any other tool, then continue freely. The model supports forced tool use. Which two configurations should you use? (Select two.)
- After finding fabricated values, your team made every field in the invoice schema nullable. Now invoice_number, which every valid invoice carries, comes back null on blurry scans, and those extractions pass validation silently and post with no invoice number. What change would most effectively fix this?
- Your review findings schema has one location field holding strings like "src/api/orders.ts:42". The comment poster splits on the colon, which breaks on Windows paths and on ranges such as "src/a.ts:40-44", so about 2% of comments post to the wrong place. What schema change would most effectively fix this?
- Your document_type enum is invoice, receipt, contract or other, with an other_detail string. Truly new types, such as pro forma invoices, land in other correctly. But documents that could be either an invoice or a credit note also land in other, and are processed as new types instead of being checked. What change would most effectively fix this?
- When an invoice extraction fails the line-items-must-sum check, your retry sends Claude the failed JSON and the error "line items sum to 450, stated total is 500". The retried extractions now pass, but an audit finds that Claude has been changing line-item amounts until they match the total. What change would most effectively fix the retry?
- Developers dismiss about 30% of your reviewer's findings, but the dashboard can only show dismissal rates per category, such as "correctness", and every category is around 30%. You cannot tell which code constructs cause the dismissals. What change would most effectively make the problem analysable?
- Your purchase-order pipeline retries any extraction that fails validation, with specific error feedback. Analysis shows 22% of retries never succeed, and all of them are orders whose PO number appears only in a covering email that the pipeline does not send to Claude. The retry budget is running out. What change would most effectively address this?
- About 4% of your invoices state a total that differs from their line items. Today the extractor silently reconciles them, sometimes changing the total and sometimes a line item, so the output always sums. Auditors want every mismatch visible, with the printed figures preserved. What schema change would most effectively meet this?
- Your pipeline validates generated tests before committing them. Two failures recur: tests that import fixtures with the wrong casing, such as user_factory instead of UserFactory, and tests that assert on a partner API whose contract is not in the repository, so their expected values are guesses. How should the pipeline handle these two failures?
- Five extractions failed validation in today's run. Which two are most likely to be fixed by a retry that includes the document, the failed extraction and the specific error? (Select two.)
- When an extraction fails validation, your pipeline retries with "Your previous extraction failed validation. Please try again more carefully." About 70% of retries fail again on the same field, and logs show the second extraction is often identical to the first. What change would most effectively improve the retries?
- You added detected_pattern to review findings, and after a month the data is clear: findings on "unused function parameter" are dismissed 75% of the time, mostly on interface implementations that must keep the parameter. Other patterns sit around 10%. What should you do with this data?
- Your extraction already uses tool_use with a strict schema. A teammate wants to add a JSON-repair library "to fix the validation errors", but the failure log shows dates placed in the wrong field and line items that don't sum to the stated total. What should you recommend?
- Some service contracts state a 30-day notice period in the main body and 90 days in an appendix. Your extractor returns one value, chosen inconsistently, and legal discovered the conflict only when a renewal deadline was missed. What schema change would most effectively address this?
- Your review job validates each finding before posting, and about 5% fail because the cited line lies outside the diff. Today the retry says only "line number invalid", and half the retries pick another wrong line. The diff and the finding are already in the retry. What change would most effectively improve the retries?
- Your extraction pipeline retries every validation failure up to three times. Logs show retries succeed 80% of the time for date-format errors and 70% for misplaced fields, but under 2% for missing purchase-order references, which make up a third of all retries. What change would most effectively improve the retry strategy?
- To control cost, your pipeline sends each 40-page contract to the extractor in 10-page chunks. The termination clause is on page 31, so chunk one fails validation for the missing clause, and three retries with specific feedback all fail too. What change would most effectively fix this?
- After two retries with specific error feedback, about 3% of your reviewer's findings still fail validation, for example citing a function the diff doesn't contain. Currently the job keeps retrying up to ten times, then posts the last version anyway. What change would most effectively handle these findings?
- Your insurer extracts claim forms in two places. During phone calls, adjusters upload a form and wait for the fields before they can continue the call. Overnight, the whole day's forms are re-extracted for the fraud-analytics warehouse. To cut cost, a manager proposes moving everything to the Message Batches API. What should you recommend?
- Your static-analysis summaries must be available within 36 hours of each commit. You send commits to the Message Batches API, which can take up to 24 hours, and posting results takes up to 2 hours afterwards. What is the least frequent submission schedule that still guarantees the 36-hour target?
- A batch of 2,000 extraction requests finishes with 1,958 succeeded and 42 errored. Of the errors, 30 are documents that exceeded the context limit and 12 failed with a temporary server-overload error. Results are needed by tomorrow's run. What should you do?
- Your nightly test-generation job writes tests, calls a run_tests tool that executes them on your runner, reads the failures and revises the tests within the same turn. To halve the cost, a colleague proposes moving each module's request into the Message Batches API unchanged. What should you tell them?
- Last month's batch of 20,000 contract extractions needed three resubmission rounds: 18% of documents failed validation the first time, mostly because of two layouts the prompt handled badly. This month's batch of 25,000 is due next week. What should you do before submitting it?
- Your nightly review batch sends one request per changed file and sets custom_id to the pull-request number, so results can be posted back to the right PR. Tonight's submission was rejected with a validation error about custom_id. What change would most effectively fix this and keep results traceable?
- Your nightly review batch of 3,000 requests ended, and the job assembled the morning report from the results file. Reviewers later found that 140 pull requests had no review at all: their results were errored or expired, but the job treated every line in the file as a successful review. What change would most effectively fix this?
- A batch of 10,000 extractions completes, and 120 fail your semantic validation, mostly line items that don't sum to the total. The team's habit is to rerun the whole batch with a tweaked prompt. What should you do instead?
- A nightly CI job asks Claude to fix lint errors in each changed file and calls a run_linter tool after each edit to check the result before continuing. To save money, the team wants to move it to the Message Batches API. Which approach should you take?
- Downstream systems must attach each batch extraction result to the right document record, including its tenant and source system. A developer proposes putting the tenant and record ID in each prompt and asking Claude to echo them in its output. What should you do instead?
- Your extraction team is reviewing which of its workloads could move to the Message Batches API for the 50% saving without hurting anyone who relies on them. Which two workloads should move? (Select two.)
- You are moving nightly test generation to the Message Batches API. In the synchronous version, Claude reads each module and its existing tests with a read_file tool before writing new tests. A teammate is unsure how the batch version will see the code. What should you do?
- Your nightly extraction forces an extract_invoice tool to get schema-valid output, and the model supports forced tool use. A teammate argues it can't move to the Message Batches API because "batches don't support tool calling". What should you tell them?
- Each night your pipeline reviews about 8,000 pull requests with the Message Batches API. Product now wants the 50 PRs tagged release-blocker reviewed within an hour of tagging, at any time of day. What should you do?
- Your extractor processes 120-page contract bundles in a single pass. Fields from the early schedules are complete, the later schedules come back sparse, and the output gives payment terms of net 30 from the main agreement and net 60 from schedule 7 without noticing the conflict. What change would most effectively improve the extraction?
- Your pipeline generates a module and then, in the same session, asks Claude to review it with extended thinking and a large thinking budget. The reviews are long and thoughtful, but they keep approving defects that a reviewer seeing the code for the first time spots in minutes. What change would most effectively improve the reviews?
- Your verification pass labels each finding keep or drop. Reviewers see only the keeps, and you now find that about one dropped finding in ten was a real defect, while about a fifth of the keeps are dismissed. You have 300 findings that developers have already labelled as real or not. What change would most effectively improve routing?
- Your validation step checks 40 extracted invoices in a single request, looking for problems within each invoice and for duplicates across them. It gives contradictory verdicts, accepting a missing VAT number on one invoice and rejecting the same problem on another, and it misses duplicate invoices numbered INV-0042 and INV-042. What change would most effectively fix this?
- After extracting a mortgage application, your pipeline asks the same conversation to "double-check the extraction against the document." It confirms almost everything, including an income figure copied from the wrong applicant, which a reviewer seeing the case for the first time caught immediately. What change would most effectively improve the check?
- Your reviewer handles a 40-file pull request in one pass. It gives detailed comments on early files and thin ones on later files, contradicts itself about the same pattern in two places, and missed a renamed field that broke three callers in other files. Which two changes should you make? (Select two.)
- Your pipeline runs an independent verification instance on every extracted field, which doubles cost. Errors in payment amounts and bank details are costly; errors in fields like supplier contact name are cheap to fix later, and those fields already pass deterministic format checks. Finance wants cost cut without weakening protection where it matters. What should you recommend?
- For the payment amount and payee bank account on each invoice, an error is costly. Your pipeline extracts them once, then asks the same instance to "double-check those two fields", which almost never changes anything. What change would most effectively catch errors on these fields?
- Your multi-pass review, with per-file passes, an integration pass and an independent verifier, costs about three times a single pass. Finance wants it cut. Most pull requests touch one or two files; about 15% touch ten or more, and nearly all missed cross-file bugs come from those. What should you recommend?
- Your verifier checks 80-page loan agreements against their extracted fields in a single pass. It catches errors in fields taken from the first 30 pages, but misses most errors in fields drawn from the later schedules. What change would most effectively improve verification?
- To reduce false positives, your pipeline runs two independent review instances on each pull request and posts only findings both report. False positives fell, but developers found that subtle real bugs, such as a race condition only one instance caught, now never reach them. What change would most effectively improve this?
- Your per-file passes work well, and you are adding an integration pass for cross-file issues. A teammate proposes giving it every changed file in full plus all the per-file findings, about 120,000 tokens on large pull requests. What should the integration pass receive?
- Verification of your 60-page contract extractions misses errors in later sections, and when it does flag something it often agrees with the extractor's own justification, which it receives as notes. Which two changes would most improve verification? (Select two.)
- Your pipeline adds a second reviewer to verify the first: it receives the diff and the first reviewer's findings, and is asked which findings are valid. It confirms almost all of them, including two developers later showed were wrong, and it rarely adds new ones. What change would most effectively improve this step?