AI Foundations · 22% practice allocation

AI Foundations: Prompt Engineering Practice Questions

5 free sample questions from the Prompt Engineering 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 researcher compares two prompts for solving logic puzzles. Prompt A says: 'Answer the following logic puzzle.' Prompt B says: 'Answer the following logic puzzle. First, list all given facts. Then, identify the constraint. Finally, derive the answer.' The researcher finds Prompt B significantly outperforms Prompt A. Which TWO prompting concepts BEST explain this improvement? (Select TWO)

  • A. Role prompting
  • B. Few-shot prompting
  • C. Chain-of-thought prompting✓ Correct
  • D. Prompt decomposition into sub-steps✓ Correct
  • E. Temperature reduction
  • F. Self-consistency sampling
Explanation

Prompt B explicitly instructs the model to reason step by step (list facts → identify constraints → derive answer), which is the core of chain-of-thought prompting. This also represents decomposing the task into structured sub-steps, a related best practice that breaks a complex problem into manageable stages. Role prompting assigns a persona and is not present here. Self-consistency requires multiple runs and majority voting, which is not described. Few-shot prompting requires examples, which are absent. Temperature reduction is a parameter change, not a prompting technique, and is not mentioned.

2.

A developer writes a system prompt that includes: 'You are a helpful assistant. You must never discuss competitor products. Respond only in formal English. Limit all responses to 150 words.' Which TWO categories of instructions are present in this system prompt? (Select TWO)

  • A. Output format constraints
  • B. Persona definition✓ Correct
  • C. Few-shot examples
  • D. Chain-of-thought activation
  • E. Behavioral constraints✓ Correct
Explanation

The instruction 'You are a helpful assistant' defines the model's persona. The instructions to never discuss competitors and to respond in formal English are behavioral constraints that restrict the model's actions. Output format constraints refer to things like 'respond in JSON' or specific structural rules—'150 words' is a length constraint that can overlap, but the clearest two distinct categories here are persona and behavioral constraints. Chain-of-thought activation is not present (there is no 'think step by step' instruction). Few-shot examples are not included anywhere in this prompt.

3.

An engineer is designing a prompt for a financial Q&A assistant. They want the model to be conservative, preferring precise commonly-accepted answers over creative speculation. Which combination of parameter settings is MOST appropriate?

  • A. Temperature = 0.1, top-p = 0.85✓ Correct
  • B. Temperature = 1.0, top-p = 1.0
  • C. Temperature = 1.5, top-p = 0.99
  • D. Temperature = 0.8, top-p = 0.5
Explanation

A low temperature (0.1) minimizes randomness and keeps the model focused on high-probability tokens, producing conservative and consistent outputs. A moderate top-p (0.85) still allows some nucleus sampling flexibility while excluding very low-probability tokens. Temperature 1.5 / top-p 0.99 maximizes diversity and creativity—the opposite of what is needed for a precise financial assistant. Temperature 0.8 / top-p 0.5 restricts the token pool aggressively with top-p while also introducing moderate randomness—an inconsistent and suboptimal combination. Temperature 1.0 / top-p 1.0 is the default setting (no restriction), which allows the full range of the probability distribution and is inappropriate for conservative financial use.

4.

A developer includes the following in a prompt: 'Input: Translate to French: Hello → Output: Bonjour | Input: Translate to French: Goodbye → Output: Au revoir | Input: Translate to French: Thank you → Output: '. Which prompting technique is being applied?

  • A. Chain-of-thought prompting
  • B. Zero-shot prompting
  • C. Few-shot prompting✓ Correct
  • D. Iterative prompt refinement
Explanation

Few-shot prompting provides the model with a small number of input-output examples to demonstrate the desired task format before presenting the actual query. This is exactly what the developer is doing with two translation examples. Zero-shot would provide no examples. Chain-of-thought asks the model to show its reasoning steps. Iterative prompt refinement is a process of evaluating and improving prompts over time, not a structural technique.

5.

An AI engineer is using chain-of-thought (CoT) prompting for a multi-step arithmetic word problem. Which addition to the prompt would MOST effectively trigger chain-of-thought reasoning in the model?

  • A. Providing three examples of correctly formatted final answers without reasoning
  • B. Setting the top-p parameter to 0.1
  • C. Appending 'Answer in JSON format' to the prompt
  • D. Adding the phrase 'Let's think step by step.' at the end of the question✓ Correct
Explanation

Research, including Google's original CoT paper, demonstrated that appending 'Let's think step by step.' reliably elicits step-by-step reasoning from large language models. Requesting JSON format controls output structure, not reasoning process. A low top-p restricts token sampling diversity but does not induce reasoning. Providing final answers without reasoning (few-shot without CoT examples) does not teach the model to show its work.

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

Prompt Engineering study guide (AI Foundations) →

Other AI Foundations domains

← All AI Foundations study resources