The short answer
In AP Computer Science Principles (AP CSP), sequencing is the idea that a program’s steps run one after another, in order. It is one of three basic algorithm types in the course, along with selection and iteration.
The three algorithm types
- Sequencing: steps run in the order they are written.
- Selection: a condition decides which steps run, as with an
ifstatement. - Iteration: a set of steps repeats, as with a loop.
Course materials ask students to build programs that include all three types, and to trace code that uses them. Tracing means working through the code one step at a time to predict what it does.
Sequencing in practice
Here is a short example:
total = 0
total = total + 5
total = total * 2
print(total)
The program prints 10. A student tracing it would write down the value of total after each line: 0, then 5, then 10.
Tracing code
A trace table is a common way to organize this work. List each variable in a column, then add a row for each line that runs. Update the values as you go, and use the table’s last row to predict the output. Tracing is most useful when a program has a mix of all three algorithm types, because it shows which lines run and which are skipped.
How sequencing fits with the other two types
Sequencing gives the default order. Selection and iteration change that order. A program might read a value, use an if statement to choose a path, and then repeat a step in a loop. Each part is simple on its own, and the trace shows how they combine.
For the choice part, see what is selection in computer science. Outside AP CSP, sequence also has a data meaning, covered in what does sequence mean in computer science.
Course version changes
The College Board is revising the course framework for fall 2027. Groupings and unit names may differ from the current course and exam description, so check the version your class uses.
Common mistakes in AP CSP
- Confusing a sequence of statements with a loop that repeats them.
- Forgetting that a variable must be assigned before it is used.
- Tracing a program without updating the variables after each line.
Summary
- Sequencing means a program’s steps run one after another, in order.
- It is one of three basic algorithm types in AP CSP, with selection and iteration.
- Tracing code line by line is the main way to check what a program does.