โ What is Sequencing?
Sequencing means running instructions in a specific order, one step at a time.
Computers execute instructions exactly in the order they are written unless told otherwise.
Think of sequencing like a recipe:
- Preheat oven
- Mix ingredients
- Bake cake
๐ฏ Why Sequencing Matters (College Board Perspective)
Programs are built using:
- Sequencing
- Selection (decisions)
- Iteration (loops)
Sequencing is the foundation of all programs.
๐ง Key Idea
- โ Computers do exactly what you tell them.
- โ Computers do NOT guess what you meant.
The order of instructions directly affects program output.
๐ Real-World Examples
Logging Into a System
- Open browser
- Enter username
- Enter password
- Click login
ATM Withdrawal
- Insert card
- Enter PIN
- Select withdrawal
- Receive cash
๐ป Programming Example (Java)
Correct Sequencing
int a = 5; int b = 10; int sum = a + b; System.out.println(sum);
Incorrect Sequencing
int sum = a + b; // ERROR int a = 5; int b = 10;
๐ฅ Execution Flow
Programs execute:
- Top to bottom
- One line at a time
System.out.println("Step 1");
System.out.println("Step 2");
System.out.println("Step 3");
โ ๏ธ Common Student Mistakes
- Using variables before declaring them
- Using input before reading it
- Incorrect order of operations
๐ Tracing Example (AP Style)
int x = 3; x = x + 2; x = x * 4; System.out.println(x);
Output: 20
๐งช Mini Practice
int a = 2; int b = 3; System.out.println(a + b); a = 10; System.out.println(a + b);
Output:
5 13
โญ Big Ideas to Remember
- Programs run top โ bottom
- Changing order changes results
- Variables must exist before use
- Sequencing is the foundation of programming
๐ College Board Vocabulary
- Algorithm โ step-by-step procedure
- Execution โ running program instructions
- Statement โ single instruction
- Program Flow โ order instructions run