---
title: "Run-Time Error — AP CSP Definition & Exam Guide"
description: "A run-time error is a mistake that occurs while a program is executing, like dividing by zero. Learn how AP CSP tests it against syntax and logic errors."
canonical: "https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error"
type: "key-term"
subject: "AP Computer Science Principles"
unit: "Unit 1"
---

# Run-Time Error — AP CSP Definition & Exam Guide

## Definition

In AP Computer Science Principles, a run-time error is a mistake in a program that occurs during the execution of the program, such as dividing by zero. Each programming language defines its own run-time errors, and the program may crash or stop when one happens (EK CRD-2.I.3).

## What It Is

A run-time error is a mistake that doesn't show up until the [program](/ap-comp-sci-p/unit-1/program-function-purpose/study-guide/8hL8KatG4rAWTwZSglGB "fv-autolink") is actually running. The code is written correctly enough to start executing, but something goes wrong mid-run. Classic example: your program divides a [number](/ap-comp-sci-p/unit-3/variables-assignments/study-guide/vtJhAf5XFOkm1uHNDMvh "fv-autolink") by a user's input, and the user types 0. The code looked fine, but the moment that division executes, the program crashes.

The key word is *when*. A [syntax error](/ap-comp-sci-p/key-terms/syntax-error "fv-autolink") stops you before the program ever runs because you broke the language's rules. A run-time error waits until execution to bite you. The CED also notes that programming languages define their own run-time errors, so what crashes a Python program might be handled differently in JavaScript. Many run-time errors depend on input, which is exactly why testing with inputs at or beyond the extremes (EK CRD-2.J.2) is how you catch them before the user does.

## Why It Matters

Run-time errors live in Topic 1.4 (Identifying and Correcting Errors) in [Unit 1](/ap-comp-sci-p/unit-1 "fv-autolink"): Creative Development. Learning objective [AP Comp Sci P](/ap-comp-sci-p "fv-autolink") 1.4.A asks you to identify an error and correct it, and to do that you need to classify it first. The CED defines four error types side by side: logic, syntax, run-time, and overflow (EK CRD-2.I.1 through CRD-2.I.4). The exam loves giving you a buggy scenario and asking which type of error it is. Run-time errors also connect directly to 1.4.B and testing, because the whole point of testing with defined inputs is to flush out the errors that only appear during execution.

## Connections

### [Syntax error (Unit 1)](/ap-comp-sci-p/key-terms/syntax-error)

[Syntax](/ap-comp-sci-p/key-terms/syntax "fv-autolink") errors and run-time errors are separated by timing. A syntax error breaks the language's rules and prevents the program from running at all. A run-time error happens only once the program is executing. If the program never started, it's not a run-time error.

### [Logic error (Unit 1)](/ap-comp-sci-p/key-terms/logic-error)

A [logic error](/ap-comp-sci-p/key-terms/logic-error "fv-autolink") doesn't crash anything. The program runs to completion but produces wrong or unexpected results because the algorithm itself is flawed. Run-time errors are loud (the program stops); logic errors are quiet (the program lies to you).

### [Overflow error (Unit 1)](/ap-comp-sci-p/key-terms/overflow-error)

An [overflow error](/ap-comp-sci-p/key-terms/overflow-error "fv-autolink") happens when a computer tries to handle a number outside its defined range of values (EK CRD-2.I.4). It's really a specific flavor of execution-time failure, so MCQs sometimes put it next to run-time error to see if you know the precise definitions.

### Testing with defined inputs (Unit 1, Topic 1.4)

EK CRD-2.J.2 says to test inputs at or just beyond the extremes (minimum and maximum). That's run-time error hunting. Inputs like 0, negative numbers, or empty values are exactly the cases that trigger crashes during execution, so good test cases are your early-warning system.

## On the AP Exam

Run-time errors show up in multiple choice, usually in one of two ways. First, scenario classification: you get a description like "a program divides a number by a user input" and have to recognize that an input of 0 causes a run-time error, not a syntax or logic error. Second, definition matching: a stem asks which option "best describes a run-time error," and the right answer is the one tied to execution, not to broken language rules or wrong output. Questions also probe why run-time errors are trickier than errors caught before execution, since they can depend on specific inputs and only surface when the program is actually running. No released FRQ has used this term verbatim, and since 2023 the AP CSP exam no longer includes the written Create response anyway, so MCQ classification is where this term earns its points.

## run-time error vs logic error

Both happen while the program runs, which is why they get mixed up. The difference is the symptom. A run-time error stops or crashes the program during execution (divide by zero, accessing something that doesn't exist). A logic error lets the program finish normally but produce incorrect or unexpected results, like using + when you meant *. Crash means run-time; wrong answer means logic.

## Key Takeaways

- A run-time error is a mistake that occurs during the execution of a program, which means the program started running before it failed.
- Dividing by zero is the go-to AP example, especially when a user input could be 0, because the error only appears for that specific input.
- Each programming language defines its own run-time errors, so the exact behavior depends on the language being used.
- Run-time errors crash or stop the program, while logic errors let the program finish but produce wrong results, and syntax errors prevent the program from running at all.
- Testing with inputs at or just beyond the extremes (EK CRD-2.J.2) is the main strategy for catching run-time errors before users hit them.

## FAQs

### What is a run-time error in AP Computer Science Principles?

It's a mistake in a program that occurs during the execution of the program, defined in EK CRD-2.I.3. A common example is dividing by zero, which only fails once that line of code actually runs.

### Is a run-time error the same as a syntax error?

No. A syntax error breaks the rules of the programming language and stops the program from running at all. A run-time error only happens while the program is executing, so the code passed the language's rules but failed in action.

### How is a run-time error different from a logic error?

A run-time error crashes or halts the program during execution, like dividing by zero. A logic error lets the program run to completion but produce incorrect or unexpected results. One stops the program; the other gives you a wrong answer.

### Does dividing by zero cause a run-time error?

Yes, in most languages it does, and it's the classic AP CSP example. The error only triggers during execution when the divisor actually equals zero, which is why testing inputs like 0 matters.

### Why are run-time errors harder to catch than syntax errors?

Syntax errors get flagged before the program runs, but run-time errors often depend on specific inputs and only appear during execution. That's why EK CRD-2.J.2 tells you to test with inputs at or just beyond the extremes, since edge-case inputs are what trigger these crashes.

## Related Study Guides

- [1.4 Identifying and Correcting Errors](/ap-comp-sci-p/unit-1/identifying-correcting-errors/study-guide/pz4hGcBBElziI3R8cfnQ)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error#resource","name":"Run-Time Error — AP CSP Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T05:53:25.324Z","isPartOf":{"@type":"Collection","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error#term","name":"run-time error","description":"In AP Computer Science Principles, a run-time error is a mistake in a program that occurs during the execution of the program, such as dividing by zero. Each programming language defines its own run-time errors, and the program may crash or stop when one happens (EK CRD-2.I.3).","url":"https://fiveable.me/ap-comp-sci-p/key-terms/run-time-error","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"}},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is a run-time error in AP Computer Science Principles?","acceptedAnswer":{"@type":"Answer","text":"It's a mistake in a program that occurs during the execution of the program, defined in EK CRD-2.I.3. A common example is dividing by zero, which only fails once that line of code actually runs."}},{"@type":"Question","name":"Is a run-time error the same as a syntax error?","acceptedAnswer":{"@type":"Answer","text":"No. A syntax error breaks the rules of the programming language and stops the program from running at all. A run-time error only happens while the program is executing, so the code passed the language's rules but failed in action."}},{"@type":"Question","name":"How is a run-time error different from a logic error?","acceptedAnswer":{"@type":"Answer","text":"A run-time error crashes or halts the program during execution, like dividing by zero. A logic error lets the program run to completion but produce incorrect or unexpected results. One stops the program; the other gives you a wrong answer."}},{"@type":"Question","name":"Does dividing by zero cause a run-time error?","acceptedAnswer":{"@type":"Answer","text":"Yes, in most languages it does, and it's the classic AP CSP example. The error only triggers during execution when the divisor actually equals zero, which is why testing inputs like 0 matters."}},{"@type":"Question","name":"Why are run-time errors harder to catch than syntax errors?","acceptedAnswer":{"@type":"Answer","text":"Syntax errors get flagged before the program runs, but run-time errors often depend on specific inputs and only appear during execution. That's why EK CRD-2.J.2 tells you to test with inputs at or just beyond the extremes, since edge-case inputs are what trigger these crashes."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Computer Science Principles","item":"https://fiveable.me/ap-comp-sci-p"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-comp-sci-p/key-terms"},{"@type":"ListItem","position":3,"name":"Unit 1","item":"https://fiveable.me/ap-comp-sci-p/unit-1"},{"@type":"ListItem","position":4,"name":"run-time error"}]}]}
```
