Anthropic CCDV-F (Claude Certified Developer - Foundations) Practice Test 16

Question 150

A broad modernization mixes dependency upgrades, formatting, and behavior changes. What improves reviewability?

  1. Remove commit descriptions.
  2. Combine all future changes into the same patch.
  3. Review only the final file count.
  4. Separate coherent changes into independently understandable patches.

Explanation

Correct Answer

D:

Focused changes make causes and regressions easier to identify without requiring reviewers to untangle unrelated modifications.

Incorrect Answers

A:

Descriptions help reviewers understand intent and do not cause the underlying scope problem.

B:

Additional unrelated scope makes validation and rollback harder.

C:

File count does not explain the semantics or risk of the modifications.

Question 151

A unit test checks how an agent wrapper handles a tool timeout. What test dependency is appropriate?

  1. A mock that always returns success.
  2. No tool invocation in the test.
  3. A production service that may or may not fail.
  4. A controlled test double that raises the expected timeout.

Explanation

Correct Answer

D:

A deterministic simulated failure exercises the wrapper’s recovery path without relying on an unpredictable external outage.

Incorrect Answers

A:

Success never exercises the timeout-handling branch being tested.

B:

Skipping the interaction leaves the intended recovery path untested.

C:

Uncontrolled behavior makes the test unreliable and potentially costly.

Question 152

Unit tests mock the provider perfectly, but deployment fails on the real request shape. What additional check is needed?

  1. More tests using the same inaccurate mock.
  2. A controlled integration test against the supported provider contract.
  3. Only another mock that repeats the existing assumed provider schema.
  4. Removing validation from the mock.

Explanation

Correct Answer

B:

Mocks can reproduce incorrect assumptions. Boundary testing verifies that actual serialization and responses match the external interface.

Incorrect Answers

A:

Repeatedly testing the same assumption does not verify its compatibility with the real service.

C:

A second mock can reproduce the same mistaken assumption; the missing check must exercise the real integration contract.

D:

A less restrictive mock can conceal even more integration errors.

Question 153

Python code registers handlers inside a loop as handlers[name] = lambda: invoke(name). Later, every handler invokes the loop's final name. What should change?

  1. Sort the registry keys after the loop finishes.
  2. Bind each iteration's name when creating its handler.
  3. Copy the handler dictionary after the registration loop finishes.
  4. Rename the loop variable while keeping the same lambda capture pattern.

Explanation

Correct Answer

B:

The closure looks up the captured variable when called, after the loop has changed it. A factory or default argument can capture the intended value for each registered callable.

Incorrect Answers

A:

Sorting changes presentation order, not the variable referenced by each closure. Every handler would still resolve the same final name.

C:

Copying the mapping retains the same function objects and captured variable behavior. It does not bind different name values into those functions.

D:

Changing the variable's spelling does not change late binding. Each callable must retain the value associated with its creation iteration.

Question 154

An environment variable contains "30" for a numeric timeout. What should configuration loading do?

  1. Ignore malformed values without recording the effective setting.
  2. Parse and validate its type and permitted range at startup.
  3. Pass it unchanged into arbitrary arithmetic.
  4. Assume every environment value is already numeric.

Explanation

Correct Answer

B:

Environment values are strings; explicit conversion prevents delayed type errors and catches invalid limits before serving requests.

Incorrect Answers

A:

Silent fallback makes the deployed behavior difficult to understand and audit.

C:

Implicit assumptions can cause errors or unintended string operations.

D:

String storage does not supply the application’s required runtime type.

Question 155

Two requests read version 7 of a record and propose different updates. What prevents a silent lost update?

  1. Use version-aware conditional updates and resolve conflicts.
  2. Let the latest network response win without checking.
  3. Protect updates only with a lock local to one of several application processes.
  4. Put both updates in the model prompt after writing.

Explanation

Correct Answer

A:

The write succeeds only if its expected version remains current, exposing concurrent changes instead of overwriting them blindly.

Incorrect Answers

B:

Arrival order can discard valid changes and does not reconcile conflicting intentions.

C:

A process-local lock does not coordinate other workers, so both requests can still write based on the same stale version.

D:

Post-write discussion cannot prevent the already lost update.

Question 156

A Python helper is defined as def new_history(messages=[]): messages.append('start'); return messages. Successive calls with no argument return an increasingly long list. Why?

  1. The function body runs once at definition time and its result is cached.
  2. Python automatically copies every default list before a call.
  3. The mutable default is created once and reused across calls.
  4. Appending creates a new default list, which replaces all earlier results.

Explanation

Correct Answer

C:

Default argument evaluation occurs when the function is defined. Use a sentinel such as None and allocate a new list inside the function when callers should receive independent histories.

Incorrect Answers

A:

The body runs on each call, as shown by the growing list. It is the default list object that is created once and reused.

B:

That would isolate the lists and prevent the observed accumulation. A mutable default object is not implicitly cloned for each invocation.

D:

append mutates the existing list rather than creating a replacement. The shared object explains why successive no-argument calls accumulate entries.

Question 157

A merge conflict affects a tool schema and its handler. How should it be resolved?

  1. Reconcile both contracts and validate the merged behavior.
  2. Accept the schema from one branch and the handler from the other without compatibility checks.
  3. Delete conflict markers and keep both function bodies unchanged.
  4. Resolve only the documentation file.

Explanation

Correct Answer

A:

Accepting lines mechanically can leave the schema and implementation inconsistent; semantic compatibility must guide resolution.

Incorrect Answers

B:

Each side may be correct in isolation while their combination uses incompatible fields or parameter semantics.

C:

Removing markers alone can leave duplicate or contradictory implementations.

D:

The executable contract remains conflicted even if documentation reads cleanly.

Question 158

A generated function passes linting but returns the wrong classification. What does this demonstrate?

  1. Static style checks do not establish required behavioral correctness.
  2. The test must be wrong because syntax is valid.
  3. Linting guarantees every business rule.
  4. Increase lint strictness and skip behavior tests until lint is clean.

Explanation

Correct Answer

A:

Lint checks selected static properties. Behavioral tests are needed to show whether the function applies the required classification rule to relevant inputs.

Incorrect Answers

B:

Syntactically valid code can implement an incorrect decision.

C:

Style and selected static checks cannot prove all domain behavior.

D:

Stricter lint may find additional static issues, but it need not recognize the incorrect domain classification. Behavioral assertions are still required.

Question 159

A summarizer must never output an account identifier absent from its authorized input set. What test style directly expresses this?

  1. Check the identifier-subset invariant across varied inputs.
  2. Compare only punctuation with one saved response.
  3. Accept any response containing an identifier.
  4. Test only the empty-input case.

Explanation

Correct Answer

A:

An invariant describes a required relationship rather than one exact wording, making violations detectable across many cases.

Incorrect Answers

B:

Punctuation does not establish whether identifiers came from authorized inputs.

C:

Presence alone ignores whether the identifier is permitted.

D:

One narrow case does not exercise the relationship across normal varied inputs.

Question 160

A synchronous endpoint has a three-second deadline. Its retry policy can wait ten seconds. What must be reconciled?

  1. Only the timeout of the last attempt.
  2. Only the average response time of successful requests.
  3. The total retry and timeout budget with the endpoint deadline.
  4. Only the maximum number of attempts, ignoring backoff duration.

Explanation

Correct Answer

C:

Per-attempt settings must fit the overall request contract; otherwise recovery guarantees an unacceptable response delay.

Incorrect Answers

A:

The endpoint deadline includes earlier attempts and backoff, so a final-attempt limit does not bound the entire retry sequence.

B:

An average success metric does not enforce the maximum time a failing request can spend in retries.

D:

Attempt count alone does not bound total elapsed time when each attempt and delay consumes the endpoint deadline.

Claude Certified Developer - Foundations (CCDV-F) Practice Tests