Courseiva
Claude Code →easyMultiple Choice

CCDV-F Claude Code Practice Question

A developer wants Claude Code to add input validation to a specific function in `src/api/users.py`. Which instruction is most likely to produce a correct, targeted change?

⚠ Common exam trap

The trap here is assuming any prompt mentioning validation will do, when the decisive factor is naming the exact file, function, conditions, and expected response.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

In `src/api/users.py`, add validation to the `create_user` function that rejects requests where `email` is missing or lacks an `@` character, and return a 400 with a clear message.

Targeted instructions that specify file, function, validation rules, and expected error behavior produce minimal, verifiable edits. Claude Code performs best when the scope and acceptance criteria are explicit, because it can act confidently without guessing. Vague, unbounded, or purely documentary prompts either miss the goal or create unnecessary churn across the repository.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Check all the inputs everywhere and fix anything that looks wrong.

    Why it's wrong here

    This prompt is unbounded, so Claude Code would have to decide which inputs, which endpoints, and what counts as wrong across the entire codebase. That invites a sprawling diff touching many files, increasing review burden and the chance of unintended behavior changes. It also omits the specific function and error response the scenario requires.

  • ✓

    In `src/api/users.py`, add validation to the `create_user` function that rejects requests where `email` is missing or lacks an `@` character, and return a 400 with a clear message.

    Why this is correct

    This instruction names the file, the function, the exact fields and conditions to validate, and the desired response behavior. That specificity lets Claude Code make a minimal, verifiable change without wandering into other files. It also establishes testable acceptance criteria, so the developer can immediately confirm the edit matches intent.

  • ✗

    Make the code better.

    Why it's wrong here

    This instruction gives no file, function, or acceptance criteria, so Claude Code must guess what better means and where to apply it. The result could be a formatting change, a refactor, or edits in unrelated files, none of which is the requested validation work. Vague prompts reliably produce off-target edits that the developer then has to unwind.

  • ✗

    Add a TODO comment in the users module about validation.

    Why it's wrong here

    A TODO comment does not implement validation; it merely records an intention for later. The scenario asks for an actual change to the function's behavior, not documentation of future work. This option would leave the endpoint accepting malformed input, so it fails to satisfy the requirement even though it references the right area.

About these practice questions

Courseiva writes every CCDV-F question from scratch — 257 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Anthropic exam blueprint

This CCDV-F practice question is part of Courseiva's free Anthropic certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCDV-F exam.