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

Question 140

A large local document conversion blocks the Python event loop before any API call. What should change?

  1. Increase model output tokens.
  2. Move blocking computation to an appropriate worker or execution facility.
  3. Increase the number of asynchronous tasks on the same blocked event loop.
  4. Add async to the function name only.

Explanation

Correct Answer

B:

Move substantial CPU work to a suitable worker or process so other scheduled requests can make progress while conversion runs.

Incorrect Answers

A:

The stall occurs locally before inference, so generation limits are irrelevant.

C:

Scheduling more tasks cannot make progress while synchronous CPU work monopolizes that loop's execution thread.

D:

Naming does not change blocking computation into cooperative asynchronous work.

Question 141

User text contains quotation marks and newlines. How should it enter a JSON request body?

  1. Use a proper JSON serializer for the data structure.
  2. Concatenate the raw text between quote characters.
  3. Delete every quote from the user’s text.
  4. Use HTML escaping as JSON serialization.

Explanation

Correct Answer

A:

Serialization escapes characters according to JSON rules and avoids malformed bodies produced by manual string assembly.

Incorrect Answers

B:

Unescaped input can terminate strings or introduce invalid JSON syntax.

C:

Destructive cleanup alters content unnecessarily instead of encoding it correctly.

D:

HTML entities follow a different format and do not replace correct JSON encoding.

Question 142

Urdu text becomes corrupted when a request is encoded with an incompatible character set. What should be verified?

  1. Only the text displayed after the server has already decoded the request.
  2. Consistent supported Unicode encoding through ingestion, transport, and storage.
  3. Decode each received byte chunk independently without preserving decoder state.
  4. Replacing all non-English text with question marks.

Explanation

Correct Answer

B:

Text must survive every boundary without lossy conversion; fixing only the final display may not recover corrupted bytes.

Incorrect Answers

A:

The encoding boundary must be checked where bytes become text; inspecting a later display can miss the original corruption point.

C:

Byte chunks can split multibyte characters; independent decoding may corrupt otherwise valid UTF-8.

D:

That discards the information the application needs to process.

Question 143

A field contract requires a JSON boolean. A parser receives the string "false" and treats every nonempty string as true. What prevents the resulting flag error?

  1. Accept the exact string true and silently map every other input to false.
  2. Use Python bool(value) for every incoming flag without parsing its type.
  3. Validate the expected boolean type before using the value.
  4. Remove the flag from all records silently.

Explanation

Correct Answer

C:

String truthiness differs from boolean meaning. Type-aware validation prevents a textual false from enabling a feature.

Incorrect Answers

A:

That can turn malformed or unexpected input into an accepted false value. The declared boolean contract requires validation, not a catch-all fallback conversion.

B:

A nonempty string such as "false" is truthy in Python; generic truthiness is not a Boolean text parser.

D:

Discarding required data changes the contract rather than validating it.

Question 144

A PATCH endpoint distinguishes an omitted field from an explicit null. What must the request builder preserve?

  1. The difference between “leave unchanged” and “clear the value.”
  2. Serialize every field as an empty string.
  3. Serialize every unspecified field as null to simplify the request shape.
  4. Replace every absent field with null.

Explanation

Correct Answer

A:

Omission and null can express different update intentions; collapsing them can accidentally erase stored data.

Incorrect Answers

B:

Empty strings are another value and may violate the intended update semantics.

C:

That converts absence into an explicit value and can clear fields when the PATCH contract assigns different meanings to omission and null.

D:

That converts unspecified updates into explicit clearing operations.

Question 145

An application must apply exact decimal currency rules to extracted amounts. What should its calculation layer use?

  1. Convert all decimal amount strings to binary floats before computing.
  2. Decimal arithmetic with an explicit rounding policy.
  3. Unspecified rounding chosen independently at every step.
  4. Round a binary floating-point total only when displaying it.

Explanation

Correct Answer

B:

Binary floating-point can introduce representation artifacts. Declared decimal and rounding rules make monetary calculations reproducible.

Incorrect Answers

A:

Many decimal fractions have no exact binary floating-point representation. This can conflict with the specified exact decimal arithmetic and rounding policy.

C:

Inconsistent rounding can produce different totals for the same inputs.

D:

Final formatting may hide earlier numerical error or apply rounding at the wrong business boundary; exact decimal rules need deliberate arithmetic.

Question 146

Events arrive with different UTC offsets. How should chronological ordering compare them?

  1. Parse timezone-aware timestamps and normalize to a common time basis.
  2. Compare only the visible hour numbers.
  3. Discard offsets before parsing.
  4. Sort the original local timestamps as strings while ignoring offsets.

Explanation

Correct Answer

A:

Equivalent instants can have different local representations; comparisons must account for their offsets. Normalize aware timestamps to comparable instants, then format them in a chosen display timezone only after determining their order.

Incorrect Answers

B:

Local hours without offsets can reverse the true order of events.

C:

Removing timezone information loses the data needed for accurate comparison.

D:

Lexicographic local time order can disagree with actual chronological order when events use different UTC offsets.

Question 147

A consumer must reject unexpected fields in a strict command contract. What should enforce this?

  1. Passing every field directly into a privileged function.
  2. Explicit schema or parser rules governing additional properties.
  3. Declare required fields without restricting additional properties.
  4. Parse the body as JSON without applying the command schema.

Explanation

Correct Answer

B:

Configure and run a validator that rejects undeclared properties. Required-field declarations or a schema document alone do not enforce the command's permitted field set.

Incorrect Answers

A:

Blind forwarding broadens the executable interface beyond the intended contract.

C:

Required-field rules establish presence of named properties; they do not by themselves reject extra properties outside the command contract.

D:

Successful JSON parsing establishes syntax, not the permitted field set. Extra object properties can survive parsing unchanged.

Question 148

A developer replaces an agent’s parser implementation without intending behavior changes. What is the key validation goal?

  1. Accept the refactor whenever its benchmark runs faster.
  2. Check that both parsers return an object, without comparing field values or errors.
  3. Preserve the established contract across representative and edge-case inputs.
  4. Change output field names for readability without updating callers.

Explanation

Correct Answer

C:

A refactor changes structure while retaining required behavior; tests should detect unintended semantic differences.

Incorrect Answers

A:

Performance improvement does not prove that the new parser preserves the required behavioral contract.

B:

Matching the outer return type does not establish equivalent interpretation, validation, or failure behavior.

D:

That alters the public contract rather than preserving it.

Question 149

Claude produces a large code change and says all tests passed. What should a reviewer verify?

  1. Approve solely because the explanation is confident.
  2. Skip the diff when the patch is long.
  3. Inspect the diff and actual test execution evidence.
  4. Accept only files with familiar names.

Explanation

Correct Answer

C:

Inspect the actual diff and trustworthy test execution results. Generated claims about passing tests do not establish which checks ran or what they exercised.

Incorrect Answers

A:

Confidence does not validate code behavior or test results.

B:

Large scope increases the need for careful review rather than removing it.

D:

Familiar names do not establish correctness of their modified contents.

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.

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