Overview
AP Computer Science Principles Practice 2: Algorithms and Program Development is the computational thinking practice where you develop and implement algorithms. In plain terms, you build step by step processes to solve problems and then turn those steps into working code or trace what they do. This practice has two skills: representing algorithms without a programming language (2.A) and implementing and applying an algorithm (2.B).
Both skills show up on the multiple-choice section and can appear in your Create written responses. If you can describe a process clearly in words or a flowchart and then carry it out correctly, you are doing Practice 2.

What Practice 2: Algorithms and Program Development Means
An algorithm is a finite set of instructions that accomplishes a task. Practice 2 covers two related abilities:
- Describing the logic of an algorithm in a form anyone can read, like plain language steps, pseudocode, or a diagram (2.A).
- Putting that logic into action by building or running it, including in actual program code (2.B).
The course does not use one required programming language, so the exam uses a shared Exam Reference Sheet with block-based and text-based versions of common constructs. Practice 2 is about the thinking behind the steps, not memorizing one language.
What This Practice Requires
You need to do two main things accurately.
2.A: Represent algorithmic processes without using a programming language
- Write or read step by step instructions in plain language or pseudocode.
- Use sequencing, selection (decisions), and iteration (repetition) correctly.
- Fill in missing steps so a described process works as intended.
- Recognize when a loop should stop and what condition controls it.
2.B: Implement and apply an algorithm
- Carry out an algorithm and produce the correct result.
- Apply a known process, like adding 1 in binary or moving a robot along a path.
- Choose the code segment that produces a required outcome.
- Combine constructs such as conditionals and loops to reach a goal.
Skills You Need for This Practice
- Sequencing: Steps run in order, and order changes the result.
- Selection: Use IF and IF-ELSE logic to make decisions based on conditions.
- Iteration: Use loops and know the stopping condition, often something like "repeat until position is greater than n."
- Tracing: Walk through an algorithm with specific values to find the output.
- Variables and counters: Track values like
countandpositionas the algorithm runs. - Pattern recognition: Spot when a process is a search, a count, or a transformation.
How It Shows Up on the AP Exam
The end-of-course exam is 70 multiple-choice questions worth 70 percent, plus Create performance task written responses worth 30 percent. Practice 2 questions appear throughout the multiple-choice section, and Big Idea 3: Algorithms and Programming is weighted 30 to 35 percent, so this practice carries real weight.
Common formats you will see:
- Fill in the missing steps. A plain language algorithm is given with blanks, and you choose the steps that make it work. The right answer usually has the correct loop and the correct stopping condition.
- Apply a process. You execute a known operation, such as finding the next binary number after 1001 0011, which is 1001 0100.
- Pick the correct code segment. You choose the segment that moves a robot along a marked path or draws a required figure.
Practical tip: when a question gives answer choices that differ only in the stopping condition, test each one with a small example to see which loop actually ends correctly.
Examples Across the Course
Practice 2 connects to many units, not just one.
- Unit 2, Binary Numbers: Implement the "add 1" algorithm in binary. If the last ID was 1001 0011, the next is 1001 0100. This is 2.B applied to data representation.
- Unit 3, Iteration and Lists: Represent a counting algorithm in plain language. To count list elements greater than 100, you increase
positionby 1 and repeat the check untilpositionis greater thann, then displaycount. This is 2.A. - Unit 3, Developing Algorithms with a robot: Choose the code segment that moves a triangle robot to a gray square along arrows on a grid. Sequencing and turns must match the path exactly. This is 2.B.
- Unit 3, Procedures and drawing: Pick the loop that calls
drawCircle(x, y, r)in the right order to produce a figure. Where you place the call inside the loop changes the output. This is 2.B. - Unit 4, Parallel and Distributed Computing: Applying an algorithm shows up when you schedule processes across two processors to find the minimum total time, which reinforces step ordering and resource use.
How to Practice Practice 2: Algorithms and Program Development
- Write algorithms in plain language first. Before coding, list the steps in words. This builds 2.A directly.
- Trace with a table. Make columns for each variable and update them line by line. This catches loop and counter errors.
- Test the stopping condition. For every loop, ask what makes it stop and run a tiny example to confirm.
- Convert both directions. Take a pseudocode description and write code for it, then take code and describe it in words.
- Use the Exam Reference Sheet. Practice reading both block and text versions so language differences do not slow you down.
- Redo missed questions by re-tracing. When you get one wrong, find the exact step where the output diverged.
Common Mistakes
- Wrong stopping condition. Looping until
countexceeds a value when you should loop untilpositionexceedsn. The loop control variable must match what is changing. - Off by one errors. Starting
positionat the wrong index or stopping one step too early or too late. - Order mistakes. Placing a procedure call or an update in the wrong spot inside a loop, which shifts every result.
- Forgetting to initialize. Not setting a counter like
countto 0 before the loop starts. - Skipping the trace. Choosing an answer that looks right without testing it on a small example.
- Confusing represent and implement. 2.A is describing the steps, 2.B is carrying them out. Some questions test one, some test both.
Quick Review
- Practice 2 has two skills: represent algorithms without code (2.A) and implement and apply algorithms (2.B).
- Algorithms use three building blocks: sequencing, selection, and iteration.
- Order matters, and the loop stopping condition is a frequent source of right and wrong answers.
- Initialize counters before loops and trace with a value table to check output.
- This practice spans units, including binary operations, list counting, robot movement, and procedure calls.
- On the exam, test answer choices with a small example, especially when they differ only in the loop condition.