> For the complete documentation index, see [llms.txt](https://www.csprinciples.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.csprinciples.com/big-idea-1/1.4-identifying-and-correcting-errors.md). Agents can also search and read this documentation through its [MCP server](https://www.csprinciples.com/~gitbook/mcp).

# 1.4 Identifying and Correcting Errors

## Enduring Understanding

Developers create and innovate using an iterative design process that is userfocused, that incorporates implementation/feedback cycles, and that leaves ample room for experimentation and risk-taking.

## Learning Objective

For errors in an algorithm or program:

a. Identify the error.

b. Correct the error.

## Essential Knowledge

A logic error is a mistake in the algorithm or program that causes it to behave incorrectly or unexpectedly.

A syntax error is a mistake in the program where the rules of the programming language are not followed.

A run-time error is a mistake in the program that occurs during the execution of a program. Programming languages define their own run time errors.

An overflow error is an error that occurs when a computer attempts to handle a number that is outside of the defined range of values.

The following are effective ways to find and correct errors:

* test cases
* hand tracing
* visualizations
* debuggers
* adding extra output statement(s)

## Learning Objective

Identify inputs and corresponding expected outputs or behaviors that can be used to check the correctness of an algorithm or program.

## Essential Knowledge

In the development process, testing uses defined inputs to ensure that an algorithm or program is producing the expected outcomes. Programmers use the results from testing to revise their algorithms or programs.

Defined inputs used to test a program should demonstrate the different expected outcomes that are at or just beyond the extremes (minimum and maximum) of input data.

Program requirements are needed to identify appropriate defined inputs for testing.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.csprinciples.com/big-idea-1/1.4-identifying-and-correcting-errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
