Anthropic CCAR-P (Claude Certified Architect - Professional) Practice Test 39

Question 380

A generated test compares an expiry timestamp with the real current clock and fails intermittently near midnight. What design makes the boundary test reliable?

  1. Remove the expiry assertion and keep only the object-creation check
  2. Increase the allowed runtime so the test has longer to complete
  3. Run the test only during office hours in one timezone
  4. Inject a controllable clock and test explicit times around the expiry boundary

Explanation

Correct Answer

D:

The test should determine its time input rather than depend on when it runs. Explicit before, at, and after cases exercise the boundary reproducibly.

Incorrect Answers

A:

That avoids the failure by abandoning the behavior under test. The expiry rule still needs coverage with deterministic time inputs.

B:

A longer runtime does not fix an unstable time assumption and can cross additional boundaries. The test needs controlled inputs.

C:

Scheduling restricts when the defect appears without validating the boundary reliably. A controlled clock permits the same meaningful test at any run time.

Question 381

A repository installs unpinned dependencies, and the same commit sometimes fails after a fresh environment setup. What change most directly improves reproducibility?

  1. Pin only direct dependencies while allowing all transitive dependencies to float
  2. Retry installation until one environment happens to pass
  3. Use an appropriate dependency lockfile and a reproducible install process
  4. Copy one developer's entire working directory into production
  5. Record only the top-level package names without their resolved versions

Explanation

Correct Answer

C:

A fixed dependency resolution reduces unexplained differences between fresh environments. The installation process should use the recorded versions rather than resolving new ones each time.

Incorrect Answers

A:

Changes in transitive packages can still alter a fresh installation. A suitable lockfile captures the resolved dependency set needed for reproducibility.

B:

Retries do not explain or control changing dependency versions. They can conceal the source of nondeterministic setup behavior.

D:

An opaque directory copy is difficult to audit and maintain. The repository should describe a reproducible environment instead of relying on an untracked snapshot.

E:

Names alone allow different versions and transitive dependencies to be selected. The stated failure requires a more complete resolution record.

Question 382

An assistant proposes a fix for a subtle parsing bug, but the existing tests all pass before the change. What verification step best establishes that the new test exercises the reported defect?

  1. Add a test that asserts the new helper function exists
  2. Run only the modified implementation and accept any passing test output
  3. Rewrite the expected output to match whichever result the assistant produces
  4. Confirm the regression case fails on the original defect

Explanation

Correct Answer

D:

A test that fails on the defect provides evidence that it can detect the problem. Passing after the fix then supports the claimed correction rather than merely reproducing existing coverage.

Incorrect Answers

A:

The presence of a helper does not establish the bug's behavior. A meaningful regression should exercise the failing input and expected outcome.

B:

A test that never detects the original defect may not validate the fix. The before-and-after behavior is important for this subtle regression.

C:

That would make the test follow the implementation instead of the requirement. The expected result must be grounded in the reported parsing behavior.

Question 383

A requested error-message fix produces a patch that also changes authentication logic and formatting in many unrelated files. What should the developer do before accepting it?

  1. Inspect the full diff, isolate the requested change, and investigate the unrelated behavioral edits
  2. Run a formatter and assume all remaining edits are necessary
  3. Accept the whole patch because the requested error message is now correct
  4. Review only the files mentioned in the final assistant summary

Explanation

Correct Answer

A:

Generated patches can exceed the task's scope. Reviewing the complete diff reveals changes that need separate justification and prevents accidental acceptance of unrelated behavior.

Incorrect Answers

B:

Formatting does not establish the purpose or correctness of behavioral changes. The authentication edits still require review and scope control.

C:

A correct visible fix does not validate other changes. The authentication modification could introduce a separate defect or security issue.

D:

The summary may omit changes or describe them incompletely. The actual diff is the evidence of what will be committed.

Question 384

A coding assistant creates a sample configuration containing a live credential copied from the local environment. Which two actions are appropriate before sharing the change? Choose TWO.

  1. Commit the credential because the repository is currently private
  2. Add the file to ignore rules without removing it from an already staged patch
  3. Remove the live secret from the patch and use a safe configuration mechanism or placeholder
  4. Replace the value in the example documentation but leave it in the staged configuration
  5. Assess exposure and rotate the credential if it has been disclosed beyond its intended boundary

Explanation

Correct Answers

C:

The repository example should not distribute a usable credential. The application can obtain secrets through the approved runtime configuration instead.

E:

Removing the current patch does not invalidate copies already exposed. Rotation depends on the exposure, which must be assessed rather than assumed away.

Incorrect Answers

A:

Private repositories still distribute content to people and systems with access. Privacy status does not make a live secret appropriate example configuration.

B:

Ignore rules do not necessarily remove tracked or staged content. The actual patch must be inspected and corrected before sharing.

D:

Changing one occurrence does not remove the secret from the actual patch. Every included file must be checked before the change is shared.

Question 385

A development assistant needs to run a specific test command repeatedly. The environment supports narrowly scoped command permissions. What permission choice best fits the task?

  1. Permit any command whose text contains the word 'test'
  2. Authorize the required test operation within its intended scope
  3. Require manual review of every harmless output line instead of controlling execution
  4. Grant production deployment permission because tests may eventually precede release
  5. Grant unrestricted shell execution for every future repository task

Explanation

Correct Answer

B:

The permission should match the known development need. A narrow grant reduces unnecessary authority while allowing the repeated verification work.

Incorrect Answers

A:

A substring is not a reliable security boundary. Unrelated or harmful commands can contain that word while performing other operations.

C:

Reviewing output is different from authorizing commands and can create noise. The permission mechanism should constrain the operation itself.

D:

A possible later step is not part of the current requirement. Deployment authority should be considered when that action is actually needed.

E:

That permission exceeds the stated need and persists beyond the current operation. Convenience does not require broad authority when narrow permissions are available.

Question 386

A shared MCP configuration contains one engineer's absolute home-directory path and personal credential. It fails on teammates' machines. What should the team change?

  1. Tell teammates to edit the shared file differently and commit their local paths
  2. Copy the engineer's home directory to every teammate's machine
  3. Use portable configuration with documented prerequisites and per-user or managed credential injection
  4. Store the personal credential in the repository to ensure everyone has it

Explanation

Correct Answer

C:

Shared configuration should represent the team's service setup without embedding one person's environment or secret. Prerequisites and credential handling need to work across installations.

Incorrect Answers

A:

Competing machine-specific commits create continuing configuration churn. The shared configuration should separate portable settings from local values.

B:

That duplicates personal state and may expose credentials or unrelated files. It does not create a maintainable portable configuration.

D:

A shared live secret creates accountability and exposure problems. Portability should be achieved through an approved credential mechanism.

Question 387

A Python project adds a local file named requests.py. Imports intended for the installed requests package now load that local file and fail. What should the developer examine and correct?

  1. The resolved module path and the local naming collision
  2. The installed package's HTTP timeout defaults
  3. Reinstall the same package without removing or renaming the local module
  4. The installed package version without checking which module path was loaded

Explanation

Correct Answer

A:

Python import resolution can select a local module before the intended installed package. Inspecting the resolved path identifies the collision so the local file can be renamed appropriately.

Incorrect Answers

B:

The failure arises during module resolution before the intended package is used. Request timeout settings cannot correct a local file shadowing that package.

C:

Reinstallation can leave import precedence unchanged. The local requests.py file can continue to shadow the installed package until the collision is resolved.

D:

A version check can describe the installed distribution while Python imports a different local file. The resolved module path is the decisive evidence here.

Question 388

Two developers use coding assistants on separate tasks in the same checkout, repeatedly overwriting each other's uncommitted changes. What working arrangement best reduces this conflict?

  1. Share one checkout but ask both assistants to avoid editing at the same moment
  2. Use different branches while both sessions retain the same working directory
  3. Have each assistant automatically overwrite files with its preferred version
  4. Separate worktrees or checkouts with distinct branches and deliberate integration
  5. Commit every intermediate edit directly to the production branch

Explanation

Correct Answer

D:

Independent working directories isolate in-progress edits while version control preserves a clear integration path. The arrangement addresses file interference without prohibiting parallel work.

Incorrect Answers

A:

Informal timing is fragile and does not isolate uncommitted state. Separate working directories provide a stronger boundary for concurrent changes.

B:

Branch names alone do not provide simultaneous independent working trees. Both sessions can still interfere with shared files and uncommitted state.

C:

That would increase lost work and hide conflicting changes. Integration requires reconciling contributions rather than unconditionally replacing them.

E:

Frequent commits do not make unfinished changes ready for production. The team still needs isolated work and controlled integration.

Question 389

A generated database migration drops a column before all application instances stop reading it. What rollout approach is safer?

  1. Keep the migration order but add a comment explaining the expected outage
  2. Restore the column only if customers report failures
  3. Use a compatible staged migration that removes the old field only after consumers have transitioned
  4. Deploy the destructive migration first and rely on rapid application updates

Explanation

Correct Answer

C:

Schema and application versions may coexist during rollout. An expand-and-contract approach preserves compatibility until the old dependency is no longer active.

Incorrect Answers

A:

A comment documents the risk without reducing it. The rollout can be designed to preserve compatibility across the transition.

B:

Reactive restoration accepts a predictable failure that can be avoided. The dependency should be handled before dropping the field.

D:

There is still a window when old instances read the missing field. Speed does not eliminate the compatibility failure during coexistence.

Question 390

A command-line integration reports only 'AI failed' for authentication errors, invalid inputs, and temporary service failures. What improvement would most help maintainers respond correctly?

  1. Include every raw request and secret in the terminal error output
  2. Return one success exit status and place all failure details in free-form prose
  3. Return distinct safe error categories with actionable context and a correlation identifier
  4. Retry every failure automatically until the command succeeds

Explanation

Correct Answer

C:

Different failure classes require different responses. Structured categories and trace correlation support diagnosis without exposing credentials or sensitive payloads.

Incorrect Answers

A:

Detailed output can create a disclosure while still overwhelming maintainers. Error reporting should provide useful context with appropriate redaction.

B:

A success status can mislead callers and automation even if the text describes an error. Distinct safe categories should make the actual outcome actionable.

D:

Some errors require changed credentials or input rather than retries. A generic loop can hide the cause and amplify load.

Claude Certified Architect - Professional (CCAR-P) Practice Tests