Quiz: API Basics
Why This Matters
Module 2 is the base for everything that follows. This quiz checks the decisions, not the syntax. Answer before you open each answer; the questions are written by Learn Automated Testing, not taken from the real exam.
1. TestPilot’s answers drive an automatic message to the developer who broke the build. Which setup is the safest?
- A. Ask for JSON in the prompt and parse it with
JSON.parse - B. Ask the model to double-check its own JSON before answering
- C. Use the highest effort setting
- D. Send a schema as the output format and validate the result in code before acting
Show answer
2. The nightly triage job crashes when the API returns an overloaded error for one of 40 failures. What is the best fix?
- A. Retry that request with backoff, and if it still fails, report it as untriaged while keeping the other 39 results
- B. Retry the whole job from the start
- C. Switch to a smaller model
- D. Run the job less often
Show answer
3. Your system prompt and category definitions are 3,000 tokens and identical on every call. What reduces cost without changing the output?
- A. Shorten the definitions
- B. Lower
max_tokens - C. Prompt caching for the unchanging part at the start of the request
- D. Move the definitions into the user message
Show answer
4. In npm run ask, the third question gets an answer that ignores the first triage. What is the most likely cause?
- A. The model forgot the conversation after two turns
- B.
max_tokensis too high - C. The system prompt is too long
- D. Your code did not send the earlier user and assistant messages
Show answer
5. TestPilot sometimes returns “flaky” for a failure whose history is all “passed”. Which change is the most reliable?
- A. Add “never say flaky without failure history” to the system prompt in capitals
- B. Reject “flaky” in code when the failure rate is 0, and retry once with that feedback
- C. Lower the temperature
- D. Add five examples of flaky tests to the prompt