Question 120
A template inserts a customer name into JSON. A name containing quotes breaks the request. What is the correct repair?
- HTML-escape the name and insert it directly into JSON
- Escape values for a URL query string and insert the result into JSON without serialization
- Retry the same malformed JSON indefinitely
- Remove every customer with punctuation in their name
- 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?
- Remove prompt identifiers from logs
- Copy a prompt screenshot into the runbook
- Always resolve whichever draft was edited most recently
- 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?
- Delete all previous assistant turns while retaining every user turn indefinitely
- Treat a generated summary as an immutable source of truth
- Summarize older dialogue while retaining verified critical fields and recent turns
- Drop all turns except the first
- 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?
- Resolve the contradictory requirements and test one coherent output contract
- Double the output token limit
- Add more contradictory examples
- 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?
- Use a prompt flow or orchestrator with explicit validation and conditional branching
- Store every output as approved before validation
- Let the model silently invent absent fields
- 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?
- Compare only prompt character count
- Change the model and dataset together with each prompt
- Use the same held-out inputs, model configuration, and scoring rubric for both
- 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?
- Separate localization rules from immutable business values and validate numeric fields
- Translate currency codes as ordinary prose
- Ask the model to convert every currency without an exchange-rate source
- 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?
- Treat the model's statement "valid JSON" as verification
- Accept any response containing curly braces
- Parse and validate the result against a schema and business constraints
- Set temperature to zero and omit parser validation
- 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?
- Encode the secret in base64 inside the prompt
- Use an opaque tool operation and resolve the secret only in the authorized executor
- Return the credential to the model as a tool observation and redact only the final response
- 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?
- Require only a syntax check before an editor can promote a prompt globally
- Assign owners, approval criteria, and a recorded promotion workflow
- Allow any editor to overwrite production without review
- 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?
- Add more real examples to dilute each customer's visibility
- Increase maximum output length
- Rely only on a sentence saying examples are private
- 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.