Question 120

A template inserts a customer name into JSON. A name containing quotes breaks the request. What is the correct repair?

  1. HTML-escape the name and insert it directly into JSON
  2. Escape values for a URL query string and insert the result into JSON without serialization
  3. Retry the same malformed JSON indefinitely
  4. Remove every customer with punctuation in their name
  5. Serialize structured values with a JSON encoder rather than raw string interpolation

Explanation

Correct Answer

E:

Encoding handles quote and escape rules while preserving the value. Validate the final payload against the API schema.

Incorrect Answers

A:

HTML escaping targets markup syntax. JSON needs its own correct serialization to handle quotes, control characters, and types.

B:

Encoding rules depend on the target context. URL encoding does not construct a correctly typed JSON message and can alter the customer value unnecessarily.

C:

A deterministic serialization defect persists on every identical retry.

D:

Valid user data should not be rejected to compensate for unsafe serialization.

Question 121

A production service accidentally resolves an editable prompt draft instead of its approved release. What configuration should be deployed?

  1. Remove prompt identifiers from logs
  2. Copy a prompt screenshot into the runbook
  3. Always resolve whichever draft was edited most recently
  4. Pin the approved immutable prompt version in the release configuration

Explanation

Correct Answer

D:

A fixed version binds runtime behavior to the reviewed artifact. Promotion should update that reference through controlled deployment.

Incorrect Answers

A:

This hides the mismatch instead of preventing it and weakens diagnosis.

B:

A screenshot does not control the runtime reference or establish reproducible invocation.

C:

Recency does not indicate approval and allows unreviewed changes to affect production.

Question 122

A long-running conversation exceeds the context budget, but recent exact account choices must remain intact. What memory strategy fits?

  1. Delete all previous assistant turns while retaining every user turn indefinitely
  2. Treat a generated summary as an immutable source of truth
  3. Summarize older dialogue while retaining verified critical fields and recent turns
  4. Drop all turns except the first
  5. Send the entire history despite the model limit

Explanation

Correct Answer

C:

Compression can preserve useful history within limits. Keep authoritative values separately because summaries can omit or distort details.

Incorrect Answers

A:

This removes useful referents and still allows unbounded growth. It does not preserve the selected exact fields through a controlled bounded-memory strategy.

B:

Summaries are fallible derived artifacts. Critical transactional facts require explicit verification and state handling.

D:

The initial turn may not contain the later account choices required for the current task.

E:

Oversized input can fail validation or force uncontrolled truncation.

Question 123

A summary prompt says both "return exactly three bullets" and "never use lists." What should the developer do first?

  1. Resolve the contradictory requirements and test one coherent output contract
  2. Double the output token limit
  3. Add more contradictory examples
  4. Lower temperature and assume both rules become compatible

Explanation

Correct Answer

A:

The model cannot simultaneously satisfy incompatible format rules. Editing the contract addresses the cause rather than tuning sampling around it.

Incorrect Answers

B:

Additional capacity does not reconcile mutually exclusive format requirements.

C:

Conflicting demonstrations increase ambiguity rather than establishing the intended output.

D:

Sampling cannot remove a logical contradiction in the instructions.

Question 124

A document workflow must extract fields, validate them, and send missing-field cases to clarification instead of summarization. Which design fits?

  1. Use a prompt flow or orchestrator with explicit validation and conditional branching
  2. Store every output as approved before validation
  3. Let the model silently invent absent fields
  4. Use one unconditional summary prompt for every input

Explanation

Correct Answer

A:

Control flow makes missing-field handling enforceable. Each stage receives validated outputs rather than relying on a single prose instruction.

Incorrect Answers

B:

Persisting approval first reverses the required control sequence.

C:

Fabrication defeats validation and can contaminate downstream business actions.

D:

The workflow has distinct required outcomes. Unconditional summarization bypasses missing-field handling.

Question 125

Two prompt candidates differ in examples and output structure. How should the team isolate their effect on extraction quality?

  1. Compare only prompt character count
  2. Change the model and dataset together with each prompt
  3. Use the same held-out inputs, model configuration, and scoring rubric for both
  4. Score each candidate on its own handpicked successes

Explanation

Correct Answer

C:

Controlled conditions reduce confounding. Compare task-level failures as well as aggregate scores.

Incorrect Answers

A:

Length does not measure whether extraction outputs satisfy the task.

B:

Multiple simultaneous changes prevent attributing the observed difference to the prompt.

D:

Different selected examples bias the comparison and conceal regressions.

Question 126

A billing assistant must use the caller's selected language without changing amounts or currency codes. Which instruction strategy fits?

  1. Separate localization rules from immutable business values and validate numeric fields
  2. Translate currency codes as ordinary prose
  3. Ask the model to convert every currency without an exchange-rate source
  4. Infer language exclusively from the customer's name

Explanation

Correct Answer

A:

Language adaptation should affect presentation while preserving authoritative amounts. Post-validation detects accidental value changes.

Incorrect Answers

B:

Standard codes identify currencies and should not be altered by free-form localization.

C:

That changes business values and introduces an unsupported calculation.

D:

Names do not reliably express language preference and can introduce bias.

Question 127

A prompt asks for a JSON object with a positive integer quantity. What additional control is needed before a purchase service consumes it?

  1. Treat the model's statement "valid JSON" as verification
  2. Accept any response containing curly braces
  3. Parse and validate the result against a schema and business constraints
  4. Set temperature to zero and omit parser validation
  5. Store the output without parsing and execute immediately

Explanation

Correct Answer

C:

Well-formed JSON can still contain a negative quantity or unexpected field. Validation establishes an admissible input before execution.

Incorrect Answers

A:

A generated assurance is not an independent parser or constraint check.

B:

Braces do not prove syntactic validity or acceptable field values.

D:

Reduced sampling variability does not enforce JSON syntax, required fields, or positive quantities.

E:

This gives unvalidated generated content authority over a business operation.

Question 128

A reusable prompt needs to refer to a backend credential without exposing the credential to the model. What design fits?

  1. Encode the secret in base64 inside the prompt
  2. Use an opaque tool operation and resolve the secret only in the authorized executor
  3. Return the credential to the model as a tool observation and redact only the final response
  4. Insert the secret into the system prompt and forbid repeating it

Explanation

Correct Answer

B:

The model can request an operation without seeing its credential. Secret retrieval and use remain in trusted application code.

Incorrect Answers

A:

Encoding is reversible and does not remove model exposure.

C:

The model would still receive the secret. Protecting the final display does not implement the stated goal of keeping credential resolution inside the executor.

D:

The model still receives the sensitive value. A prohibition is not data minimization.

Question 129

Multiple teams edit shared prompts, and nobody is accountable for safety review. What governance change fits?

  1. Require only a syntax check before an editor can promote a prompt globally
  2. Assign owners, approval criteria, and a recorded promotion workflow
  3. Allow any editor to overwrite production without review
  4. Use a single anonymous account for every edit

Explanation

Correct Answer

B:

Ownership establishes who can accept behavior changes. A workflow provides evidence that required checks occurred before release.

Incorrect Answers

A:

A syntactically valid prompt can alter safety or business behavior. The workflow needs accountable owners and behavior-based approval criteria, not just parseability.

C:

Uncontrolled edits remove the approval boundary and accountability needed by the organization.

D:

Shared anonymous access prevents reliable attribution of changes.

Question 130

Few-shot examples include real customer records, and outputs occasionally reproduce them. What should the team change?

  1. Add more real examples to dilute each customer's visibility
  2. Increase maximum output length
  3. Rely only on a sentence saying examples are private
  4. Replace examples with representative synthetic or properly de-identified records

Explanation

Correct Answer

D:

Demonstrations should teach structure without unnecessary personal data. Check that replacements preserve the task distinctions.

Incorrect Answers

A:

More sensitive records increase exposure rather than providing a privacy control.

B:

More capacity can permit more reproduction and does not remove sensitive input.

C:

The model still sees the data, and instruction following does not eliminate leakage risk.

AWS Certified Generative AI Developer - Professional AIP-C01 Practice Tests