What Is Prompt Engineering and Why Do Interviewers Ask About It
Prompt engineering is designing inputs to language models that reliably produce the outputs you need. It is the most accessible AI skill, but depth reveals how well you understand model behavior, failure modes, and production constraints.
The interview signal is not whether you know prompting tricks — it is whether you can reason about why certain techniques work, when to use them, and what happens when they fail.
Core Techniques
Chain-of-Thought (CoT)
Asks the model to show reasoning step by step before a final answer. Dramatically improves multi-step logic, math, and reasoning tasks.
| Variant | How it works |
|---|---|
| Zero-shot CoT | Add "Let us think step by step" — simple but effective |
| Few-shot CoT | Provide 2-3 examples with worked-out reasoning — more reliable for structured tasks |
CoT increases output tokens (more cost, more latency) in exchange for accuracy. For simple classification where the model already performs well, CoT adds cost without benefit. Always match technique to task complexity.
Few-Shot vs Fine-Tuning
| Few-Shot Learning | Fine-Tuning |
|---|---|
| < 100 examples | 1000+ examples with consistent patterns |
| Requirements change frequently | Stable, well-defined task |
| Need to iterate quickly | Need minimal per-request latency/cost |
| Base model is close to your needs | Domain-specific patterns prompting cannot teach |
| Zero infrastructure | Requires training pipeline + model versioning |
The production answer: most teams start with few-shot, measure quality gaps, and only fine-tune when prompting cannot close the gap. Saying this shows you have seen the real workflow.
Structured Output Control
Reducing Hallucinations
No technique eliminates hallucination entirely. The engineering answer is layered defenses: ground with context, instruct for honesty, verify with citations, monitor with evaluation.
Prompt Injection Defense
How to Explain This in an Interview
Treating prompt engineering as art rather than engineering discipline is a red flag. Production systems need evaluation, versioning, testing, and iteration.
Common Interview Questions
- Chain-of-Thought Prompting — When and how to use reasoning chains
- Few-Shot vs Fine-Tuning — Choosing between in-context learning and model adaptation
- Prompt Injection Defense — Protecting AI systems from adversarial inputs
- Reducing Hallucinations — Grounding LLM outputs in facts
- Structured Data Extraction — Reliable structured output from unstructured text
What to Practice Next
Browse all Prompt Engineering interview questions for detailed problems with walkthroughs.
Next module: AI Agents & Tool Use: Design Patterns for Autonomous Systems