# Software Engineering Foundations — Practice reading

Exam: CCDV-F — Claude Certified Developer - Foundations
Knowledge domain: Applications and Integration
HTML: https://learningpathx.com/learning-path/CCDV-F/learn/410

This public learning practice includes correct answers and existing explanations. Reading does not save progress or create a test.

## Question 1

Type: single\_choice
Knowledge point: REST APIs and JSON

An integration developer is fixing a request to the team's internal report service. Its published contract requires `max_items` to be a JSON number representing a positive whole number and `preview` to be a JSON boolean. It performs no string-to-number or string-to-boolean coercion. For this service, status 422 means the body parsed as JSON but failed the field-type contract; it does not indicate a transport failure.

The caller wants a limit of four items and preview mode disabled. The captured exchange is:

```http
POST /v1/reports HTTP/1.1
Host: reports.example
Content-Type: application/json

{"max_items":"4","preview":"false"}

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{"error":{"code":"field_type_mismatch","fields":["max_items","preview"]}}
```

The method, path, and headers already match the service contract. Which replacement body satisfies the field types and preserves the caller's requested values?

### Options

**A**

`{"max_items":4,"preview":"false"}`

**B**

`{"max_items":"4","preview":false}`

**C**

`{"max_items":4,"preview":false}`

**D**

`{"max_items":4,"preview":true}`

Correct answer: C

### Explanation

The original body is valid JSON; its two field values have the wrong types for this service. Correcting those types while preserving the requested limit and disabled preview yields the body with numeric 4 and boolean false. The received response makes repeating the same body as a transport retry inappropriate.

## Question 2

Type: single\_choice
Knowledge point: REST APIs and JSON

A service exposes this application-defined REST contract: `POST /summaries` accepts JSON with `limit` as an integer and `include_sources` as a boolean; a valid creation returns HTTP 201, and a type violation returns HTTP 400 without creation. A client sends:

```http
POST /summaries HTTP/1.1
Content-Type: application/json

{"limit":3,"include_sources":"false"}
```

Which interpretation and correction fit the exchange?

### Options

**A**

The body is invalid JSON syntax; change the method to GET

**B**

The body is valid JSON but violates the boolean type; send false without quotes

**C**

The quoted false is a boolean, so expect 201 with no correction

**D**

HTTP 400 means the transport failed before the server could inspect the body

Correct answer: B

### Explanation

The body is syntactically valid JSON, but the include\_sources value is a string. Under the supplied application contract, a boolean false is required and the type violation produces a 400 response without creating a resource.

## Question 3

Type: multiple\_choice
Knowledge point: REST APIs and JSON

A hypothetical inventory endpoint defines this contract: POST /reservations accepts application/json with quantity as an integer and expedited as a Boolean. Its schema permits quantity = 0, but its business rule requires quantity >= 1\. A request that passes JSON parsing and schema validation but violates that business rule returns 422 with error\_code = "quantity\_must\_be\_positive".

The complete relevant exchange is:

```http
POST /reservations HTTP/1.1
Host: inventory.example
Content-Type: application/json
Accept: application/json

{"quantity":0,"expedited":true}

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{"error_code":"quantity_must_be_positive"}
```

Which two interpretations are correct? (Choose 2.)

### Options

**A**

The request represents quantity as a JSON number and expedited as a JSON Boolean.

**B**

The response establishes a JSON syntax error because the quantity value is not quoted.

**C**

The exchange shows a business-rule rejection after parsing and schema validation under the supplied endpoint contract.

**D**

The 422 response shows a transport failure because the server did not return a success status.

**E**

The request must use "true" instead of true to preserve expedited as a Boolean.

Correct answer: A, C

### Explanation

Separate the representation from validation outcomes: the request has valid numeric and Boolean JSON values, and the endpoint contract identifies the returned 422 error as a business-rule rejection. The generic status alone would not prove the endpoint-specific validation order; that order is explicitly supplied here.

## Question 4

Type: single\_choice
Knowledge point: REST APIs and JSON

Which direct API request element defines the expected arguments for a tool in a minimal tool-using agent?

### Options

**A**

A copied user session cookie

**B**

A tool schema with an input definition

**C**

A retry-after response header

**D**

An archived batch status

Correct answer: B

### Explanation

* A. Consumer session credentials are not an API integration mechanism.
* B. Tools require an input schema to define their expected arguments.
* C. Retry-after is a server response header, not a tool definition.
* D. Archived status is unrelated to direct interactive execution.

## Question 5

Type: single\_choice
Knowledge point: REST APIs and JSON

An application-defined REST API documents that creating a job is asynchronous. HTTP 202 means accepted and queued; only `GET /jobs/{id}` with state=completed and a result proves completion. Repeating POST creates another job. A captured exchange is:

```http
POST /jobs HTTP/1.1
Content-Type: application/json

{"dry_run":false,"record_id":"A9"}

HTTP/1.1 202 Accepted
Content-Type: application/json

{"id":"job9","state":"queued"}
```

What should the client do before treating job9 as complete?

### Options

**A**

Poll GET /jobs/job9 and verify completed state with its result

**B**

Treat the 202 response as proof that processing finished

**C**

Repeat POST /jobs until a response arrives faster

**D**

Change false to "false" so the server treats the request as complete

Correct answer: A

### Explanation

The supplied API contract distinguishes acceptance from completion and identifies the GET resource for observing the same job. Repeating creation would create a different job, and changing the JSON boolean to a string would not alter that lifecycle rule.

## Question 6

Type: multiple\_choice
Knowledge point: REST APIs and JSON

Which two practices reduce debugging risk when designing a tool-using AI application? (Choose 2.)

### Options

**A**

Assume a framework's internal tool parsing is always correct.

**B**

Start with direct API calls for simple agent patterns.

**C**

Add framework layers until prompts and responses are hidden.

**D**

Inspect raw HTTP requests and responses during diagnosis.

Correct answer: B, D

### Explanation

* B. Direct API use avoids unnecessary abstraction in simple workflows.
* C. Hidden layers create a black-box debugging problem.
* D. Raw request and response inspection isolates integration behavior.

## Question 7

Type: single\_choice
Knowledge point: Asynchronous programming

In CPython 3.11, a supervisor starts two workers in a TaskGroup:

```python
async with asyncio.TaskGroup() as group:
    group.create_task(load_required_record())
    group.create_task(refresh_preview())
```

`load_required_record()` raises ValueError while `refresh_preview()` is still awaiting network data. No worker suppresses cancellation. What behavior should the supervisor expect?

### Options

**A**

The other worker is cancelled, the group waits for completion, and a grouped exception is raised

**B**

The other worker runs independently forever because TaskGroup never cancels siblings

**C**

ValueError becomes a normal return value without an exception handler

**D**

Leaving the block immediately abandons both workers without waiting

Correct answer: A

### Explanation

A non-cancellation failure in a Python 3.11 TaskGroup cancels the remaining tasks. The group waits for its tasks to finish and raises the failures in an exception group, rather than returning the exception as a successful result.

## Question 8

Type: single\_choice
Knowledge point: Asynchronous programming

In CPython 3.11, `fetch_a()` and `fetch_b()` are independent async functions that return values and raise on failure. `publish(a, b)` must run only after both succeed. Inside an already running event loop, which replacement for `PLACEHOLDER` starts the fetches concurrently and respects this dependency?

```python
async def build():
    PLACEHOLDER
    publish(a, b)
```

### Options

**A**

a = await fetch\_a(); b = await fetch\_b()

**B**

a, b = await asyncio.gather(fetch\_a(), fetch\_b())

**C**

a = fetch\_a(); b = fetch\_b()

**D**

a, b = asyncio.gather(fetch\_a(), fetch\_b())

Correct answer: B

### Explanation

Awaiting gather schedules both coroutine arguments concurrently and yields their results in argument order. With its default exception behavior, a fetch failure prevents control from reaching publish in this function.

## Question 9

Type: single\_choice
Knowledge point: Asynchronous programming

In CPython 3.11, `blocking_read()` is a normal function representing blocking file I/O. It must run while an independent async heartbeat continues. The event loop is already running:

```python
import asyncio
import time

def blocking_read():
    time.sleep(0.4)
    return "file contents"

async def read_file():
    PLACEHOLDER
```

Which replacement avoids running this blocking call on the event-loop thread and returns its result?

### Options

**A**

return blocking\_read()

**B**

return await blocking\_read()

**C**

return await asyncio.to\_thread(blocking\_read)

**D**

return asyncio.create\_task(blocking\_read())

Correct answer: C

### Explanation

asyncio.to\_thread runs a normal function in a separate thread and returns an awaitable for its result. It fits the stated blocking I/O task; declaring the caller async or calling the function before create\_task does not move that work off the loop thread.

## Question 10

Type: single\_choice
Knowledge point: Asynchronous programming

In CPython 3.11, two created Tasks are blocked on unset asyncio.Event objects. No other code sets the events. The supervisor executes:

```python
done, pending = await asyncio.wait(tasks, timeout=0.02)
```

Here tasks is a nonempty set containing those two Tasks. When wait returns because the timeout expires, which statement is correct?

### Options

**A**

Both Tasks are pending; the timeout alone does not cancel them

**B**

Both Tasks are automatically cancelled and appear only in done

**C**

wait raises TimeoutError and returns no sets

**D**

The timeout causes the blocked workers to return successful values

Correct answer: A

### Explanation

asyncio.wait returns done and pending sets and does not cancel pending tasks when its timeout expires. With the stated events remaining unset, neither worker has completed; their future cleanup remains the supervisor's responsibility.

## Question 11

Type: single\_choice
Knowledge point: Asynchronous programming

In Python 3.11, load\_left() and load\_right() are independent asynchronous I/O coroutines that return their respective data and may raise ValueError. publish(left, right) is an asynchronous dependent action that must run only after both loads succeed. The loads should be scheduled concurrently. If one load raises ValueError, the other load must be allowed to continue rather than being automatically cancelled by the selected concurrency primitive. The caller catches the failure and keeps the event loop running; no surrounding timeout, external cancellation or shutdown changes this case. Which implementation meets these requirements? (Choose 1.)

### Options

**A**

`python async def run(): left, right = await asyncio.gather(load_left(), load_right()) await publish(left, right) `

**B**

`python async def run(): left = await load_left() right = await load_right() await publish(left, right) `

**C**

`python async def run(): left, right = await asyncio.gather( load_left(), load_right(), return_exceptions=True ) await publish(left, right) `

**D**

`python async def run(): async with asyncio.TaskGroup() as group: left = group.create_task(load_left()) right = group.create_task(load_right()) await publish(left.result(), right.result()) `

Correct answer: A

### Explanation

Choose gather with its default exception behavior, then await the dependent action after successful results. The error path skips publish while leaving the sibling awaitable running under the stated continuing event loop. Sequential await, unchecked exception-valued results and TaskGroup sibling cancellation each fail a different explicit requirement.

## Question 12

Type: single\_choice
Knowledge point: Version control and SDLC integration

An application developer must commit a report-limit change and its matching test, without including an unrelated configuration experiment. All three files below are tracked. There are no other changes, no hooks or aliases that alter staging, and no process changes the files during this workflow.

`HEAD` identifies the current committed revision. The complete relevant repository state is:

| File | Content at HEAD | Content in index | Content in working tree | Intended in this commit |
| --- | --- | --- | --- | --- |
| `src/report_limit.py` | `LIMIT = 10` | `LIMIT = 20` | `LIMIT = 25` | `LIMIT = 25` |
| `tests/test_report_limit.py` | `assert LIMIT == 10` | `assert LIMIT == 10` | `assert LIMIT == 25` | `assert LIMIT == 25` |
| `config/experiment.conf` | `mode = stable` | `mode = stable` | `mode = trial` | `mode = stable` |

The source file was added to the index before the limit was changed from 20 to 25\. A recorded CI run passed for the current `HEAD`; it did not test the uncommitted changes. The developer can stage, review, commit, and request CI.

Which workflow reviews the exact intended snapshot before committing it and obtains CI evidence for the resulting revision?

### Options

**A**

Review `git diff --cached -- src/report_limit.py tests/test_report_limit.py`; commit without paths or `-a`; use the existing successful CI run.

**B**

Stage with `git add -- src/report_limit.py tests/test_report_limit.py`; review `git diff --cached`; commit without paths or `-a`; request CI for the new revision.

**C**

Stage with `git add -A`; review `git diff --cached`; commit without paths or `-a`; request CI for the new revision.

**D**

Review `git diff HEAD -- src/report_limit.py tests/test_report_limit.py`; commit without paths or `-a` without adding again; request CI for the new revision.

Correct answer: B

### Explanation

The next ordinary commit takes the staged snapshot. The developer must refresh the two intended paths in the index, review what is staged, and associate the new CI result with the new committed revision. The unrelated configuration edit stays outside that snapshot.

## Question 13

Type: multiple\_choice
Knowledge point: Version control and SDLC integration

Which two workflow choices integrate Claude Code with a software delivery process? (Choose 2.)

### Options

**A**

Token Counting for pull-request merging

**B**

Anthropic Code Review enabled with the repository’s automatic-review trigger configuration

**C**

Message Batches for version-control configuration storage

**D**

GitHub Actions or GitLab CI/CD for PR reviews and issue triage

Correct answer: B, D

### Explanation

The managed Code Review feature can automatically review PRs covered by the enabled repository trigger configuration; fork PRs require the documented manual-review path. CI/CD workflows can automate review and triage. GitHub Actions/GitLab CI/CD can automate review and issue triage.

## Question 14

Type: single\_choice
Knowledge point: Version control and SDLC integration

What makes project-scoped MCP configuration suitable for team use?

### Options

**A**

It is shared through version control.

**B**

It is embedded in every API response.

**C**

It is created by Message Batch results.

**D**

It is stored only in one user's private configuration.

Correct answer: A

### Explanation

* A. The project .mcp.json file can be versioned and shared with the team.
* B. API responses do not define repository configuration.
* C. Batch outputs do not author project configuration.
* D. Private user configuration is not the project-sharing mechanism.

## Question 15

Type: single\_choice
Knowledge point: Version control and SDLC integration

Where should a team store project-scoped MCP configuration that it intends to share through version control?

### Options

**A**

A Message Batch result file

**B**

A private browser cookie

**C**

The API response body

**D**

.mcp.json in the project root

Correct answer: D

### Explanation

* A. Batch results are execution output, not configuration.
* B. Browser cookies are not project configuration.
* C. API responses do not provide versioned project settings.
* D. Project scope uses .mcp.json and supports team sharing through version control.

## Question 16

Type: single\_choice
Knowledge point: Version control and SDLC integration

A Git repository has an empty index. `prompt.md` is a modified tracked file, `.claude-plugin/plugin.json` is a new untracked file, and `.env.local` is an untracked, non-ignored credential file that must not enter version control. The team must commit the first two artifacts for review. Which plan stages and inspects the intended commit content?

### Options

**A**

Run git add -A, review git diff, then commit

**B**

Run git add -- prompt.md .claude-plugin/plugin.json, review git diff --cached, then commit

**C**

Run git commit -am "Update prompt" and assume it includes the new manifest

**D**

Review git diff and commit immediately without staging either file

Correct answer: B

### Explanation

Git add stages selected paths, including a new file, and git diff --cached reviews the staged changes for the next commit. With the empty starting index, explicit paths keep the untracked credential file outside that intended staged content.

## Question 17

Type: single\_choice
Knowledge point: Code review and refactoring

Why do review agents examine both a diff and surrounding code?

### Options

**A**

It avoids reading any repository files.

**B**

It replaces the verification step.

**C**

Context helps assess whether a suspected issue is real.

**D**

It guarantees every candidate is a true positive.

Correct answer: C

### Explanation

The surrounding implementation provides behavior context for a finding. Surrounding implementation shows whether suspected behavior is real.

## Question 18

Type: multiple\_choice
Knowledge point: Code review and refactoring

Which two practices improve the reliability of a multi-agent code-review workflow? (Choose 2.)

### Options

**A**

Restrict review to filenames and skip surrounding code.

**B**

Verify candidate findings against actual code behavior.

**C**

Accept every generated finding without validation.

**D**

Have agents examine different issue classes in parallel.

Correct answer: B, D

### Explanation

* A. Surrounding code provides relevant context.
* B. Verification filters false positives against actual behavior.
* C. Unverified findings can be false positives.
* D. Parallel reviewers can cover different classes of problems.

## Question 19

Type: single\_choice
Knowledge point: Code review and refactoring

How does the code-review workflow reduce false positives from parallel reviewers?

### Options

**A**

Accept every finding if two reviewers agree, without checking the cited behavior.

**B**

It verifies candidate findings against actual code behavior.

**C**

Treat a risky-looking diff pattern as proof of a runtime defect.

**D**

Apply repository guidance only after publishing all candidate findings.

Correct answer: B

### Explanation

Actual-code verification filters incorrect candidate findings. Checking actual behavior separates real bugs from false candidates.

## Question 20

Type: multiple\_choice
Knowledge point: Code review and refactoring

Which two repository inputs guide Anthropic’s managed Claude Code Code Review feature? (Choose 2.)

### Options

**A**

The repository files it reads for review context

**B**

A user's consumer session token

**C**

REVIEW.md at the repository root

**D**

A completed Message Batch archive

Correct answer: A, C

### Explanation

Code Review reads repository files to guide its findings. Repository code supplies behavioral context for findings. REVIEW.md tailors Code Review to the repository. Root REVIEW.md supplies review-specific instructions.

## Question 21

Type: single\_choice
Knowledge point: Code review and refactoring

A Python 3.11 application permits only finite lists of built-in integers. Its public total(values) must return the integer sum, including 0 for an empty list, without mutating values. badge(values) must return that total plus 1\. No floating-point or user-defined numeric objects are in scope.

Complete original code:

```python
def total(values):
    result = 0
    for value in values:
        result += value
    return result

def badge(values):
    return total(values) + 1
```

The observations include total(\[\]) == 0, badge(\[\]) == 1, total(\[2, -2\]) == 0 and badge(\[3, 4\]) == 8.

A proposed refactor replaces only total:

```python
def total(values):
    return sum(values) if values else None
```

Which revision preserves both public functions' declared behavior for every permitted input?

### Options

**A**

Replace total with return sum(values) or 1; keep badge unchanged.

**B**

Replace total with return sum(values); keep badge unchanged.

**C**

Replace total with return sum(values) + 1; keep badge unchanged.

**D**

Keep the proposed total; replace badge with return (total(values) or 0) + 1.

Correct answer: B

### Explanation

sum starts at 0 and preserves the integer-list total. Keeping badge unchanged preserves its separate +1 contract, including the empty and zero-total cases.

## Question 22

Type: multiple\_choice
Knowledge point: Code review and refactoring

A Python 3.11 application is moving calculation code into a package. Each call receives a finite list of built-in integers and a fresh mutable audit list. The public quote function must return an integer sum; any negative element must raise ValueError("negative") before adding an audit entry. A successful call appends exactly one entry "quote:<sum>". Inputs must not be mutated.

Complete original modules:

```python
# legacy_pricing.py
def total(values):
    if any(value < 0 for value in values):
        raise ValueError("negative")
    return sum(values)

# public_api.py
from legacy_pricing import total
def quote(values, audit):
    result = total(values)
    audit.append(f"quote:{result}")
    return result

# cli.py
from public_api import quote
def render(values, audit):
    return str(quote(values, audit))

# report.py
from public_api import quote
def balance(values, audit):
    return quote(values, audit) + 1
```

Complete proposed modules: pricing/**init**.py is empty; pricing/core.py contains def total(values): return sum(values). public\_api.py keeps the same quote implementation but changes its import to from pricing.core import total. cli.py and report.py are exactly as shown above. Thus the two callers keep their public import path.

Which two actions together address the observed contract risk and verify the migration across both callers? (Choose 2.)

### Options

**A**

Change quote to return {"total": result} and update only cli.render to extract the value, treating the new package as permission to change the public return type.

**B**

Restore the negative-element check and ValueError("negative") in pricing.core.total before returning the sum; retain quote's integer return and its single audit append after total succeeds.

**C**

Accept the package move after checking only render(\[2, 3\], \[\]) == "5"; this covers the public contract even if error and audit behavior change.

**D**

Move audit.append into quote before calling total, so failed calls also add an entry, while retaining the original exception text.

**E**

Check render/balance separately with fresh audits: \[2,3\] gives "5"/6 and \["quote:5"\]; \[\] gives "0"/1 and \["quote:0"\]; \[-1,2\] raises ValueError("negative") with audit still \[\]; verify input lists remain unchanged.

**F**

Catch ValueError in both callers and return "0"/1, so the migration never exposes errors to consumers.

Correct answer: B, E

### Explanation

The move removed negative rejection. Restore it before the audit effect, retain the public facade, and verify both callers' success, empty, error and mutation contracts.

