Question 50
A compliance team needs an audit entry whenever a tool mutates a tracked file. What is a suitable hook strategy?
- Audit tool, target and outcome with PostToolUse
- Disable logging to avoid exposing tool paths to reviewers
- Make the assistant write an audit poem at the end
- Log only the user's intention before the tool executes
Explanation
Correct Answer
A:The hook observes completed work and records what actually happened. Pairing target and status supports traceability of changes.
Incorrect Answers
B:Avoiding logs defeats the stated compliance need. Sensitive audit records can be protected with access controls.
C:Generated prose is not a structured event log and may omit failed writes. Audit data should be collected from execution events.
D:Intent does not prove a file was changed. An outcome record is needed to distinguish attempted from successful mutations.
Question 51
A Claude Code team needs controls at three different points: reject a forbidden shell call before execution, normalize output after an allowed call, and inspect an end-of-turn release condition. Which THREE hook stages are appropriate? Choose THREE.
- PostToolUse for normalization of an observed tool result
- A user-supplied prompt to override all organizational restrictions
- A tool description alone to guarantee pre-execution policy enforcement
- A repository rename to trigger all three lifecycle events
- PreToolUse for the execution boundary
- Stop for an end-of-turn quality check
Explanation
Correct Answers
A:The post-use event sees the completed operation and can transform returned data while preserving error state. It is unsuitable for pre-execution authorization.
E:The pre-use event can examine proposed tool inputs and block disallowed invocations before side effects occur. It is the relevant prevention point.
F:A stop-stage hook can inspect the finalization point, while the host must still enforce any mandatory publication policy. It is distinct from tool interception.
Incorrect Answers
B:Untrusted user instructions cannot grant authorization. The mandatory controls must remain outside the model.
C:Descriptions influence model choices but are not deterministic security gates. A prohibited call still needs executor-side blocking.
D:File naming does not provide the specified hook interceptions. The correct stages correspond to tool and turn lifecycle boundaries.
Question 52
A system must block publication if an automated quality checklist fails after Claude drafts its final answer. What type of hook boundary is most relevant?
- Add a Stop-stage check and an enforced release gate
- Set a higher token budget and assume quality is now assured
- Use a pre-tool hook without inspecting any final content
- Rely on the assistant to grade itself without any external criteria
Explanation
Correct Answer
A:End-of-turn interception can evaluate whether the response meets required criteria. The application must still control final publication if it needs a hard guarantee.
Incorrect Answers
B:More tokens do not implement the checklist. The gate must evaluate the actual drafted output.
C:A pre-tool interceptor sees proposed operations, not necessarily the completed answer. It cannot validate a text-only final draft by itself.
D:Self-assessment can miss defects. A defined checklist or independent validator is required for release assurance.
Question 53
A log enrichment hook adds confidential internal fields to all tool outputs, including those sent to untrusted workers. What is the primary problem?
- The hook spreads unrelated sensitive data outside its scope
- Renaming the fields would make sensitive values harmless
- The issue can be solved by making the output text longer
- The hook should always enrich results regardless of destination
Explanation
Correct Answer
A:Normalization and enrichment should respect the consumer's scope. A shared hook must not leak fields that downstream agents do not need.
Incorrect Answers
B:Changing labels does not change the confidentiality of underlying data. Authorization and redaction are still required.
C:Verbosity does not reduce data leakage. The problem is disclosure of the wrong information.
D:Universal augmentation increases exposure and context cost. Tool-result transformations need purpose and audience constraints.
Question 54
A PreToolUse hook refuses a deployment, but the agent displays a confident success statement. What should the orchestration layer ensure?
- Increase the number of independent agents until one bypasses the hook
- Mark the hook refusal as successful deployment in the audit log
- Suppress the denial details so the assistant can complete quickly
- Treat denial as failure and verify the final claim
Explanation
Correct Answer
D:A prevented tool call is not a successful deployment. The agent must receive an accurate refusal and avoid publishing a false outcome.
Incorrect Answers
A:Circumventing a mandatory control is an architectural defect. Workers should share the enforcement boundary.
B:Reclassifying a block as success destroys policy traceability. The transaction never ran.
C:Hiding refusal evidence encourages another unapproved attempt or false success. Explicit status is needed.
Question 55
A developer wants to log every subagent start with a correlation ID before workers begin. Which integration is most direct?
- Modify each worker's task to print a decorative banner instead
- Record only final token usage without parent-child identifiers
- Wait for a customer-facing summary and guess the number of workers
- Use the subagent-start event hook and attach the parent's trace context
Explanation
Correct Answer
D:A lifecycle hook can capture spawning events and link child work to the originating orchestration run. It avoids inferring starts from text later.
Incorrect Answers
A:Generated banners are not dependable structured events. The hook can record starts without altering the task.
B:Usage alone cannot reconstruct which agent started or why. Trace correlation is needed for investigation.
C:Final prose may omit or misstate delegation. Lifecycle telemetry belongs at the event boundary.
Question 56
A tool-hook pipeline sometimes rewrites monetary values while trimming logs. Which design rule should prevent this regression?
- Disable schema validation to accept any transformed output
- Remove all number fields from tool responses
- Use typed, tested transformations that preserve key fields
- Permit arbitrary model rewriting of all numerical results
Explanation
Correct Answer
C:A hook may normalize presentation but must not silently alter semantic values. Unit tests should verify that amounts and status are unchanged.
Incorrect Answers
A:Relaxing contracts hides errors rather than preventing them. Reliable hooks must respect the downstream data schema.
B:Discarding amounts prevents the agent from deciding or reporting on financial results. Redaction should be targeted to genuinely unnecessary fields.
D:Free-form generation can introduce rounding or factual changes. Financial observations require deterministic preservation.
Question 57
A team notices that its PreToolUse hook creates a second refund request every time it inspects the first. What is the defect?
- The assistant needs a larger context to distinguish the requests
- The refund tool must be called twice for reliable confirmation
- The guard should log fewer details but keep the extra request
- The guard creates side effects, breaking idempotent checks
Explanation
Correct Answer
D:A pre-execution interceptor should not duplicate the very mutation it reviews. Its decision path must avoid unplanned external writes.
Incorrect Answers
A:An implementation side effect occurs regardless of the model's memory. The hook itself needs repair.
B:Duplicate payments are not a verification mechanism. Confirmation should inspect the original transaction state.
C:Changing log verbosity leaves the duplicate side effect intact. The hook implementation must be corrected.
Question 58
A long-running agent compacts context and loses a mandatory customer approval token. What could a compaction-related hook help implement?
- Persist approvals and restore verified facts after compaction
- Treat all approvals as permanent whenever earlier text is dropped
- Ask the model to invent the missing approval token afterward
- Turn compaction off for all sessions regardless of duration
Explanation
Correct Answer
A:A lifecycle interception point can preserve durable control facts before context changes. Approval authority must still be validated by the host.
Incorrect Answers
B:Absence of context is not proof of an active grant. Expiry and scope still need checking.
C:Authorization artifacts cannot be recreated from guesses. Missing proof requires recovery from an authoritative store.
D:Unbounded history can exceed context limits and inflate cost. A targeted state strategy addresses the missing approval evidence.
Question 59
A developer registers a broad PostToolUse hook that formats results but obscures failures. What is the correct acceptance test?
- Preserve error status and failure details after transformation
- Ignore failure cases because the model can retry automatically
- Check only whether the transformed text is shorter
- Declare success if the hook completes without throwing
Explanation
Correct Answer
A:A formatting layer must not convert an exception into apparent success. Tests should cover both success and error shapes for each matched tool.
Incorrect Answers
B:Retries require accurate failure signals. Masking them prevents informed recovery and may repeat side effects.
C:Compression alone cannot establish correctness. The decisive property is whether the consumer still sees the real outcome.
D:A functioning hook can still produce misleading payloads. Correctness includes semantic preservation.
Question 60
A research task asks for five unrelated competitor profiles and one comparative summary. Which decomposition yields the clearest critical path?
- Write the comparison before any profiles have been retrieved
- Assign all workers the entire comparison and publish every output
- Execute profiles serially despite no rate or resource constraint
- Gather profiles in parallel; synthesize after verification
Explanation
Correct Answer
D:The profiles have no prerequisite dependency on one another. Aggregation waits for their evidence and resolves differences centrally.
Incorrect Answers
A:Synthesis cannot be grounded without the component findings. This reverses the information dependency.
B:Duplicating the final task creates redundant answers with no integration owner. Workers should have nonoverlapping responsibilities.
C:Unnecessary serialization extends latency. Independent read-only subtasks can safely proceed concurrently.