AP CSP
AP Computer Science Principles / All lessons / Big Idea 3: Algorithms and Programming
3Big Idea 3: Algorithms and Programming
AP CSP topic 3.18

Undecidable Problems

A decision problem has a yes-or-no answer, like "is this number even?" A problem is decidable if an algorithm can always give the correct answer for every input. Some problems are undecidable: no algorithm can ever solve them for all inputs. The classic example is the halting problem, which asks whether any given program will eventually stop. A specific case might still be solvable even when the general problem is not.

Undecidable Problems vocabulary

  • Decision problem: A problem with a yes-or-no answer.
  • Decidable: Solvable by an algorithm that gives a correct answer for every input.
  • Undecidable: Impossible for any algorithm to answer correctly for all inputs.
  • Halting problem: Deciding whether any program will stop running; proven undecidable.

AP-style practice questions

Try each one, then open the answer. To save your progress, take this quiz in the interactive course.

Skill: Algorithms and Program Development

1. Which of the following best describes an undecidable problem?

  1. (A) A problem that takes a long time to solve
  2. (B) A problem for which no algorithm can give a correct yes-or-no answer for every input
  3. (C) A problem with more than one correct answer
  4. (D) A problem that has not been solved yet
Show answer

(B) A problem for which no algorithm can give a correct yes-or-no answer for every input Undecidable means no algorithm can solve all cases, no matter how much time it has.

Skill: Algorithms and Program Development

2. Which of the following problems is known to be undecidable?

  1. (A) Deciding if a number is even
  2. (B) Deciding if a list is sorted
  3. (C) Deciding if any given program will eventually stop running
  4. (D) Deciding if a word appears in a sentence
Show answer

(C) Deciding if any given program will eventually stop running The halting problem is the classic undecidable problem.

Skill: Algorithms and Program Development

3. Which of the following is an example of a decision problem?

  1. (A) Find the largest number in a list
  2. (B) Is 91 a prime number?
  3. (C) Sort these names alphabetically
  4. (D) Display a list of colors
Show answer

(B) Is 91 a prime number? A decision problem has a yes-or-no answer.

Skill: Algorithms and Program Development

4. A problem is undecidable. Which of the following is still possible?

  1. (A) An algorithm can answer it correctly for some specific inputs
  2. (B) An algorithm can answer it correctly for every input
  3. (C) A faster computer will solve every case
  4. (D) The problem will become decidable with more data
Show answer

(A) An algorithm can answer it correctly for some specific inputs Some instances may be solvable even though no algorithm works for all inputs.

Open 3.18 in the interactive course