Ap Computer Science A · EXAM PREP

Unit 2 · Selection and Iteration

- one exam, every section, every strategy
4 Sections11-page Guide
Our own words - no official Ap Computer Science A materials
Built for the current Ap Computer Science A format · kept up to date
The Complete AP Computer Science A Guide · AP Computer Science A

Unit 2 · Selection and Iteration

— Unit 2 map · Selection and Iteration
  • The Complete AP Computer Science A Guide
  • AP Computer Science A
  • 4 sections

Unit 2: Selection and Iteration accounts for 25–35% of AP Computer Science A multiple-choice content. Section I has 42 multiple-choice questions in 90 minutes and contributes 55% of the score. For Section II's 4 free-response questions in 90 minutes (45%), be ready to carry the same unit skills and representations into a complete solution. College Board assigns Unit 2 a 25–35% range within the multiple-choice section. The unit also supplies the control flow used by every coding task.

  • How AP Computer Science A assesses this 25–35% of the multiple-choice section · Section I: 42 MCQs in 90 min, 55% · Section II: 4 FRQs in 90 min, 45% · show the model with Boolean truth table, iteration trace table, control-flow diagram
  • Key skills Compose Boolean expressions, Design conditional logic, Trace and write loops including nested iteration
  • How to study for Unit 2 This page turns Boolean truth table, iteration trace table, control-flow diagram into one route: write the desired postcondition then choose initialization test update and branch order.
  • The organizing decision derive conditionals and loop bounds from the postcondition and trace every state update
AP Computer Science A · Unit 2 of 4
Exam weight

Unit 2: Selection and Iteration accounts for 25–35% of AP Computer Science A multiple-choice content.

Official unit name and weighting: College Board course and exam description.

Unit 2 map · Selection and Iteration

Connect the published share to the unit model

College Board assigns Unit 2 a 25–35% range within the multiple-choice section. The unit also supplies the control flow used by every coding task.

Write the boundary before the body. Then identify what each variable means at the top of an iteration so reset, accumulation, and return placement can be checked.

Use conditions to separate complete cases before they touch state. In a loop, check the final legal access, decide which values reset and which values preserve history, and place failure after the traversal unless the specification gives one element authority to decide the result.

The decision that organizes this unit

Define the system and choose the route before calculating

derive conditionals and loop bounds from the postcondition and trace every state update

First move

write the desired postcondition then choose initialization test update and branch order

Mechanism route and repair branches

Relationships to preserve

  • Boolean short-circuiting can prevent an unsafe second operand
  • A loop invariant describes what remains true after every iteration
  • Nested loops multiply or otherwise structure work according to their bounds

Representations to read

  • Boolean truth table
  • iteration trace table
  • control-flow diagram

Branches to reject

  • off-by-one loop boundaries
  • updating a sentinel in the wrong branch
  • assuming a condition is evaluated after rather than before a loop body
Key conceptWhy it's hardWhat scores
Boolean selectionAND, OR, and negation can change which cases execute.Mutually exclusive, complete conditions in the right order
Loop bounds and stateThe last legal access depends on the body.Every required value visited with current and best updated correctly
Recursive tracingCalls go down in one order and return in reverse.Stopping frame, separate locals, and correct unwind order
Assessment

How AP Computer Science A assesses Selection and Iteration

What a complete response must make visible

Match the task to evidence that a reader can audit, then check the most likely reasoning failure before finalizing the response.

TaskEvidence to showHurdle
Compose Boolean expressionsBoolean truth table; Boolean short-circuiting can prevent an unsafe second operandoff-by-one loop boundaries
Design conditional logiciteration trace table; A loop invariant describes what remains true after every iterationupdating a sentinel in the wrong branch
Trace and write loops including nested iterationcontrol-flow diagram; Nested loops multiply or otherwise structure work according to their boundsassuming a condition is evaluated after rather than before a loop body
Worked example

Resolve the Selection and Iteration evidence conflict

Carry the model from prompt to check

Q. A loop scans indexes 0 through length-1 for the first negative value; repair a version that skips index 0 and reads index length.
  • Step 1Write the desired postcondition then choose initialization test update and branch order.
  • Step 2Render the evidence as Boolean truth table and label the relevant object, scale, axis, source, speaker, or system.
  • Step 3Apply the governing relationship: Boolean short-circuiting can prevent an unsafe second operand
  • Step 4Audit the conclusion against this boundary: do not finish by off-by-one loop boundaries.
Answer. The defensible Selection and Iteration resolution uses the stated evidence and relationship, then limits the conclusion to the context and conditions supplied by the prompt.
Check. Translate the result into control-flow diagram; the claim, direction, source, units, or comparison criterion must survive unchanged.
Glossary

Key terms for Unit 2: Selection and Iteration

Models, uses, and boundaries

Compose Boolean Expressions
Boolean short-circuiting can prevent an unsafe second operand Use this Selection and Iteration relationship when the prompt presents Boolean truth table and asks you to derive conditionals and loop bounds from the postcondition and trace every state update. Stop and repair if the response starts by off-by-one loop boundaries.
Design Conditional Logic
A loop invariant describes what remains true after every iteration Use this Selection and Iteration relationship when the prompt presents iteration trace table and asks you to derive conditionals and loop bounds from the postcondition and trace every state update. Stop and repair if the response starts by updating a sentinel in the wrong branch.
Trace And Write Loops Including Nested Iteration
Nested loops multiply or otherwise structure work according to their bounds Use this Selection and Iteration relationship when the prompt presents control-flow diagram and asks you to derive conditionals and loop bounds from the postcondition and trace every state update. Stop and repair if the response starts by assuming a condition is evaluated after rather than before a loop body.
Selection and Iteration boundary-first decision
First move: write the desired postcondition then choose initialization test update and branch order Use this opening move for the original scenario: A loop scans indexes 0 through length-1 for the first negative value; repair a version that skips index 0 and reads index length. Represent the evidence with iteration trace table before extending the conclusion. The move is incomplete if it ends by updating a sentinel in the wrong branch; return to the named evidence, condition, source, or comparison boundary.
FAQ

AP Computer Science A Unit 2 FAQ

How much of AP Computer Science A does Unit 2 carry?

Unit 2: Selection and Iteration accounts for 25–35% of AP Computer Science A multiple-choice content.

What is the first move on a Selection and Iteration problem?

write the desired postcondition then choose initialization test update and branch order

Which relationships should I preserve?

Boolean short-circuiting can prevent an unsafe second operand A loop invariant describes what remains true after every iteration Nested loops multiply or otherwise structure work according to their bounds

Which representations should I practice?

Practice moving among Boolean truth table, iteration trace table, control-flow diagram.

What error should I check before submitting an answer?

Check for off-by-one loop boundaries; updating a sentinel in the wrong branch; assuming a condition is evaluated after rather than before a loop body.

Evidence workshop

Continue from the free model into complete practice

The full unit guide continues with the chapter’s worked examples, figures, scoring tables, and answer checks.

  • Trace intermediate state without running past the question
  • Read recursion as descent and unwind

Full unit practice. Open the complete guide for the full evidence workshop and synthesis.

Study strategy

How to study AP Computer Science A Unit 2

Start with the organizing decision

Before solving, restate the decision in operational terms: derive conditionals and loop bounds from the postcondition and trace every state update. Your first written move should be to write the desired postcondition then choose initialization test update and branch order.

Practice the same idea in several representations

Rotate through Boolean truth table, iteration trace table, control-flow diagram. Use each representation to practice Compose Boolean expressions, Design conditional logic, Trace and write loops including nested iteration, and explain what stays invariant when the surface form changes.

Turn each error into a repair check

After every attempt, audit the response for off-by-one loop boundaries; updating a sentinel in the wrong branch; assuming a condition is evaluated after rather than before a loop body. Then redo only the first step that made the reasoning diverge, keeping units, direction, and model conditions visible.

Confirm current course details in the official College Board course and exam description for the May 2027 administration.

AskSia is not affiliated with or endorsed by the College Board. AP is a registered trademark of the College Board.
A+Everything unlocked
Unlocks this guide + all 4 Ap Computer Science A sections - and more exam prep guides across AskSia.
Sia - your Ap Computer Science A prep tutor, unlimited, worked the way the exam marks it
The full 11-page guide + practice bank with worked solutions
Chrome extension - bring Sia to any practice question on the web
Bilingual EN / Chinese on every guide and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
Ap Computer Science A · Selection and Iteration - independent study guide on the AskSia Library. More Ap Computer Science A prep
Unlock the full Ap Computer Science A guide + 4 Ap Computer Science A sections
$0.99 Trial