Static testing examines work products WITHOUT executing code (reviews, walkthroughs, inspections, static analysis); dynamic testing executes the software to observe its behavior against expected results (functional, non-functional testing).
STATIC testing includes requirement/design/code reviews, walkthroughs, formal inspections, and static analysis tools (linters, SAST) — it finds defects early and cheaply (before code runs) and improves quality of documents/code. DYNAMIC testing runs the application (unit, integration, system, acceptance; functional and non-functional) to find defects in behavior. They're complementary: static catches issues (ambiguous requirements, code smells, security flaws) that dynamic can't easily, while dynamic catches runtime behavior static can't. Early static testing shifts defect detection left, reducing cost. Distinguishing them (and giving examples) is a common foundational question.
A code review (static) catches a SQL-injection risk and an ambiguous requirement before any code runs, while executing the feature (dynamic) reveals it crashes on an empty cart — two defect types, two techniques.
What's the difference between static and dynamic testing, and give an example of each?