AI Foundations · 20% practice allocation

AI Foundations: AI Engineering Basics Practice Questions

5 free sample questions from the AI Engineering Basics domain, with answers and explanations. The full AI Foundations bank has 735 questions across 5 domains. Questions follow the AI Foundations course content.

1.

A developer is estimating the cost impact of enabling OpenAI's prompt caching for a customer support application. The application sends 10,000 requests per day. Each request has a 3,000-token system prompt (identical across all requests) and a 500-token user message. The model charges $5.00 per 1M input tokens (full price) and $2.50 per 1M input tokens (cached price). Assuming the cache is warm for all 10,000 requests, what is the approximate daily cost saving compared to sending all tokens at full price?

  • A. Approximately $37.50 per day
  • B. Approximately $75 per day✓ Correct
  • C. Approximately $125 per day
  • D. Approximately $175 per day
Explanation

Only the 3,000-token system prompt is cached. It saves ($5.00 − $2.50) per 1M tokens: 3,000 × $2.50 / 1,000,000 = $0.0075 per request. Over 10,000 requests that is $75 per day. $37.50 halves the differential, $125 applies the saving to all 3,500 tokens at $5.00, and $175 is the full daily input cost.

2.

A developer is estimating the monthly API cost for a customer support bot. The bot uses a model priced at $3.00 per 1M input tokens and $15.00 per 1M output tokens. On average, each conversation has 800 input tokens and 200 output tokens. The bot handles 50,000 conversations per month. What is the estimated monthly cost?

  • A. $27.00
  • B. $120.00
  • C. $270.00✓ Correct
  • D. $285.00
Explanation

The correct answer is C ($270.00). Input tokens per month: 800 × 50,000 = 40,000,000 tokens = 40M tokens. Input cost: 40 × $3.00 = $120.00. Output tokens per month: 200 × 50,000 = 10,000,000 tokens = 10M tokens. Output cost: 10 × $15.00 = $150.00. Total monthly cost: $120.00 + $150.00 = $270.00. A ($27.00) is off by a factor of 10 — a common error when miscounting zeros in the per-million conversion. B ($120.00) only accounts for input cost and ignores output cost entirely. D ($285.00) results from incorrectly pricing output tokens (e.g., applying $13.50/M instead of $15.00/M).

3.

A developer's application suddenly starts receiving HTTP 429 responses from the OpenAI API during a traffic spike. What does a 429 status code indicate, and what is the recommended first response?

  • A. The API key is invalid or revoked under load; the developer should regenerate the key and redeploy it immediately
  • B. The request payload is malformed; the developer should validate the JSON against the API schema before retrying it
  • C. A rate limit (RPM or TPM) has been exceeded; implement exponential backoff with jitter and retry the request✓ Correct
  • D. The model has been deprecated mid-traffic; the developer should switch to a newer model version in the request
Explanation

HTTP 429 is the standard 'Too Many Requests' status. It means the application has exceeded its rate limits (Requests Per Minute and/or Tokens Per Minute). The industry-standard fix is exponential backoff with jitter: wait an increasing delay before each retry, which spreads load and avoids thundering-herd problems. The invalid-API-key answer is wrong because an invalid key returns HTTP 401 (Unauthorized), not 429. The malformed-payload answer is wrong because a malformed request returns HTTP 400 (Bad Request), not 429. The deprecated-model answer is wrong because a deprecated model typically returns a 404 or a specific error message in the response body, not a 429.

4.

A developer is building a legal document assistant. The system prompt (5,000 tokens) is identical across nearly every request, and the application sends hundreds of requests per hour. Which feature should they use to reduce costs and latency?

  • A. Model versioning, to pin an older, cheaper model snapshot that handles the repeated prompt at lower cost
  • B. Function calling, to move the token-heavy legal instructions into tool definitions that are billed separately
  • C. Batch API, to queue all requests asynchronously and process them overnight at a discounted rate
  • D. Prompt caching, to avoid re-processing the repeated system prompt on every request✓ Correct
Explanation

Prompt caching is built for this scenario. When a large, static prefix (like a system prompt or long document) is reused across many requests, both Anthropic's and OpenAI's caching mechanisms let the model skip reprocessing the cached tokens. That cuts input token costs and improves latency. The Batch API answer is wrong because the Batch API is for asynchronous, non-real-time jobs (e.g., overnight classification). It does not help a live, interactive document assistant that needs low-latency responses. The function-calling answer is wrong because tool definitions still count as input tokens and are not a caching mechanism, so they don't remove the cost of the system prompt. The model-versioning answer is wrong because pinning an older model may lower per-token cost slightly, but it does not stop the repeated prompt from being reprocessed, and it may sacrifice quality.

5.

A company needs to generate AI summaries for 2 million support tickets over the weekend. They are evaluating the OpenAI Batch API. Which TWO characteristics of the Batch API make it suitable for this use case? (Select TWO)

  • A. The Batch API offers a 50% cost discount compared to standard synchronous API pricing.✓ Correct
  • B. Batch API results are streamed back immediately over a server-sent events connection as each individual request in the file completes.
  • C. The Batch API is designed for offline, non-time-sensitive workloads where latency is not critical.
  • D. Batch jobs are processed asynchronously, so the application can submit work and retrieve results later without holding an open connection.✓ Correct
  • E. Batch API requests are processed synchronously in a single HTTP call, with results for the whole file returned within about one second.
  • F. The Batch API automatically splits oversized prompts into smaller chunks so each request fits within the model's context window before processing.
Explanation

The Batch API is built for large-scale, asynchronous workloads. The 50% cost discount is correct: OpenAI's Batch API costs half as much as synchronous pricing, which makes it very cost-effective for bulk jobs. Asynchronous processing is correct: jobs are submitted as a file, processed asynchronously (up to 24 hours), and results are retrieved later, which suits a weekend batch run. The claim of synchronous processing with results in about one second is false, because batch latency can be up to 24 hours. The claim that prompts are split automatically to fit context windows is false, because the Batch API does not manage context windows. The claim that results are streamed over server-sent events is false, because results are written to an output file for retrieval. The statement about offline, non-time-sensitive workloads is conceptually true, but it is treated here as not being a distinct technical 'characteristic'. The cost discount and asynchronous processing are the precise, documented features.

Test yourself across every AI Foundations domain

The free AI Foundations practice test mixes about 20 questions weighted like the exam. The full 735-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

AI Engineering Basics study guide (AI Foundations) →

Other AI Foundations domains

← All AI Foundations study resources