Welch Teaching & CoachingComputer Science · AP CSP
← AP CSP Unit Hub
AP COMPUTER SCIENCE PRINCIPLES · UNIT 4

Lists, Procedures & Abstraction

Track changing collections, procedures, parameters, and how abstractions manage complexity.

5 lessons10 estimated blocksAP topics 3.2, 3.4, 3.10, 3.12–3.1415 original exam questions

Unit overview

Use these lessons like the Algebra II and Physics pages: read the notes, learn the vocabulary, follow a worked example, attempt the quick checks before revealing solutions, and make a prediction before running the investigation.

10 blocks85-minute blocks, approximately 8–9 in the 16-week map
5 lessonsNotes, examples, vocabulary and quick checks
15 questionsFilterable exam-style bank

Success criteria

  • Use AP list notation and 1-based positions.
  • Trace APPEND, INSERT, REMOVE and list traversal.
  • Distinguish parameter and argument.
  • Trace independent calls using parameters.
  • Describe how an abstraction helps manage complexity.
Course model: CodeHS for targeted coding, this page for conceptual understanding, and AP Classroom for official aligned assessment. This is an original supplementary resource, not an official College Board publication.

Lesson map

Lesson numbering on this page is site-specific. CodeHS uses a different lesson numbering system.

Site lessonOfficial AP topicsSelected CodeHS lessons
4.1 Lists and AP indexing3.2, 3.107.2 Lists
4.2 Mutations, traversals and indexing pitfalls3.107.3 For Loops and Lists; 7.4 List Methods
4.3 Procedures, arguments, and return values3.12–3.135.1 Functions and Parameters 1; 5.2 Functions and Parameters 2; 5.4 Functions and Return Values 1
4.4 Scope, local state, and abstraction3.2, 3.12–3.135.3 Functions and Parameters 3; 5.6 Local Variables and Scope
4.5 Libraries and Create-style explanation3.145.5 Functions and Return Values 2; 6.1 Tell a Story (optional)

Content notes, vocabulary & worked examples

Each lesson ends with two quick checks. Open each answer only after attempting the problem.

Lesson 4.1 · AP 3.2, 3.10 · 1–2 blocks

Lists and AP indexing

CodeHS: 7.2 Lists

Learning targets

  • Use AP list notation and 1-based positions.
  • Trace access and assignment to elements.

Core notes

AP list indexing starts at 1, unlike Python list indexing, which starts at 0. Access an item with aList[i]; assignment changes a single element. LENGTH(aList) returns the number of elements. A single variable can name a list of many related values.

Vocabulary

list
ordered sequence of elements
index
position within a list
LENGTH
number of elements
data abstraction
grouping complexity behind a name

Worked example

scores ← [4, 7, 9]; scores[2] ← 8; DISPLAY(scores[2]) outputs 8.

Try it · Check your understanding

1. In AP pseudocode, what is [11,22,33][1]?
Show solution
11, the first element.
2. What is LENGTH([5,8,2,4])?
Show solution
4.
Lesson 4.2 · AP 3.10 · 1–2 blocks

Mutations, traversals and indexing pitfalls

CodeHS: 7.3 For Loops and Lists; 7.4 List Methods

Learning targets

  • Trace APPEND, INSERT, REMOVE and list traversal.
  • Explain effects of updating a collection during iteration.

Core notes

APPEND adds to the end, INSERT shifts elements starting at an index, REMOVE deletes the element at a position and shifts later elements left. Traversal considers each element. Avoid assuming an index remains unchanged after insertions or removals.

Vocabulary

APPEND
add item to end
INSERT
place item at index
REMOVE
delete item at index
traversal
visit elements in sequence

Worked example

a ← [3,6,9]; INSERT(a,2,4) yields [3,4,6,9]; REMOVE(a,3) yields [3,4,9].

Try it · Check your understanding

1. What is the second item after APPEND([1,2],8)?
Show solution
2; the resulting list is [1,2,8].
2. Why does removing an item affect later positions?
Show solution
Elements after the removed position shift one index left.
Lesson 4.3 · AP 3.12–3.13 · 1–2 blocks

Procedures, arguments, and return values

CodeHS: 5.1 Functions and Parameters 1; 5.2 Functions and Parameters 2; 5.4 Functions and Return Values 1

Learning targets

  • Distinguish parameter and argument.
  • Trace the value returned by a procedure call.

Core notes

A procedure is a named set of instructions. Parameters are names in its definition; arguments are values passed when called. RETURN sends a value back to a caller, while DISPLAY writes output. The AP reference sheet describes procedure syntax.

Vocabulary

procedure
named collection of instructions
parameter
input name in definition
argument
actual value passed
RETURN
send result to caller

Worked example

PROCEDURE double(n) { RETURN(n*2) }; x ← double(4) yields x=8; a procedure returning 8 need not display anything.

Try it · Check your understanding

1. What is the argument in double(7)?
Show solution
7.
2. Does RETURN always show text to the user?
Show solution
No. It provides a result to the caller.
Lesson 4.4 · AP 3.2, 3.12–3.13 · 1–2 blocks

Scope, local state, and abstraction

CodeHS: 5.3 Functions and Parameters 3; 5.6 Local Variables and Scope

Learning targets

  • Trace independent calls using parameters.
  • Explain how procedures manage complexity.

Core notes

Variables declared locally inside a procedure are used to reason about that call; do not assume every local value persists across independent calls. Procedural abstraction hides implementation behind a meaningful name. A useful abstraction can be tested and reused without duplicating logic.

Vocabulary

scope
where a variable is accessible
local variable
variable internal to a procedure
procedural abstraction
hiding details behind procedure call

Worked example

A program calling area(3,4) and area(5,2) can reuse the same rectangle-area procedure rather than repeating multiplication logic.

Try it · Check your understanding

1. Why use a procedure twice?
Show solution
Reuse the same tested implementation and avoid duplication.
2. What changes between two procedure calls?
Show solution
The arguments and the resulting local calculations may change.
Lesson 4.5 · AP 3.14 · 1–2 blocks

Libraries and Create-style explanation

CodeHS: 5.5 Functions and Return Values 2; 6.1 Tell a Story (optional)

Learning targets

  • Describe how an abstraction helps manage complexity.
  • Identify inputs, outputs, and program purpose.

Core notes

Libraries supply reusable procedures. Effective explanations identify what a procedure accomplishes, how it works at a meaningful level, and why placing it behind a name reduces repeated code or detail. A list only counts as useful data abstraction when it meaningfully manages a collection relevant to the program.

Vocabulary

library
collection of reusable operations
API
specified interface for using tools
program purpose
intended goal of program

Worked example

A quiz app keeps responses in a list rather than separate score1, score2, score3 variables; a grading procedure operates on the list.

Try it · Check your understanding

1. Why is “it makes my code shorter” not the strongest abstraction explanation?
Show solution
Better explanations describe what complexity is hidden or avoided.
2. What is one reason to use a library?
Show solution
Reuse reliable, documented functionality.

Lesson videos & resources

Core video selection: The matching CodeHS lesson video and AP Daily topic video for each lesson. Direct AP Daily videos are accessed inside the school's AP Classroom enrollment and may not have public URLs.

  1. Lesson 4.1: Lists and AP indexing. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.2, 3.10; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
  2. Lesson 4.2: Mutations, traversals and indexing pitfalls. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.10; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
  3. Lesson 4.3: Procedures, arguments, and return values. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.12–3.13; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
  4. Lesson 4.4: Scope, local state, and abstraction. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.2, 3.12–3.13; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
  5. Lesson 4.5: Libraries and Create-style explanation. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.14; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.

Additional concept resources

Video selections are topic- and platform-matched. Teachers should check account availability and assign individual CodeHS/AP Daily clips from their course dashboards.

Interactive inquiry · List state & procedure calls

Make a prediction, manipulate the model, record observations, and explain whether your original thinking was correct.

Student lab record: Before you start, write your prediction and reasoning. Afterward, record at least two trials and an evidence-based conclusion. This model is illustrative and its limitations should be noted.

List state laboratory

AP pseudocode uses 1-based indexing. Predict the list after each action. All operations act on the current list.

values ← [3, 6, 9, 12]
Current list
[3, 6, 9, 12]
Length
4

Procedure call check

PROCEDURE calculate(n) {
    RETURN(3 * n + 1)
}
result ← calculate(4)

What is result? Explain why RETURN is not the same as DISPLAY.

Show worked solution
The argument is 4. Replace n with 4: 3×4 + 1 = 13. The value is returned to the caller and stored in result; nothing is necessarily displayed.

Investigation record

Lab responses stay in this page; they are not uploaded or stored on a server.

AP-style practice & self-check

Original multiple-choice questions focus on reasoning, not just coding. Filter by lesson and difficulty. Show explanations in practice mode or hide them in exam mode.

Mastery target: 80% on mixed original questions, plus a clear written explanation on one unfamiliar scenario. Treat the bank as practice, not a secure test.

Teacher lesson specifications & implementation

Teacher-facing scope, exact learning goals, CodeHS alignments, and assessment requirements. This section can be hidden or separated before student publishing.

Pacing and lesson allocation

10 × 85-minute blocks. Shorten or extend CodeHS programming time based on prior experience and how many blocks actually meet; all lessons are supplemental to the main CodeHS course.

Default block: 10 min retrieval · 20 min notes/video · 20 min inquiry · 25 min selected CodeHS/independent practice · 10 min quick assessment.

LessonAPCodeHSMeasurable targetsAssessment specifications
4.1 Lists and AP indexing3.2, 3.107.2 ListsUse AP list notation and 1-based positions.; Trace access and assignment to elements.2 quick checks + 3 exam-bank items; lab discussion / exit ticket
4.2 Mutations, traversals and indexing pitfalls3.107.3 For Loops and Lists; 7.4 List MethodsTrace APPEND, INSERT, REMOVE and list traversal.; Explain effects of updating a collection during iteration.2 quick checks + 3 exam-bank items; lab discussion / exit ticket
4.3 Procedures, arguments, and return values3.12–3.135.1 Functions and Parameters 1; 5.2 Functions and Parameters 2; 5.4 Functions and Return Values 1Distinguish parameter and argument.; Trace the value returned by a procedure call.2 quick checks + 3 exam-bank items; lab discussion / exit ticket
4.4 Scope, local state, and abstraction3.2, 3.12–3.135.3 Functions and Parameters 3; 5.6 Local Variables and ScopeTrace independent calls using parameters.; Explain how procedures manage complexity.2 quick checks + 3 exam-bank items; lab discussion / exit ticket
4.5 Libraries and Create-style explanation3.145.5 Functions and Return Values 2; 6.1 Tell a Story (optional)Describe how an abstraction helps manage complexity.; Identify inputs, outputs, and program purpose.2 quick checks + 3 exam-bank items; lab discussion / exit ticket

Summative assessment blueprint

40 points: 20 original AP-style multiple-choice questions (1 point each), four short-answer reasoning prompts (3 points each), and one 8-point novel investigation/analysis. Mix current-unit and prior-unit topics. Use AP Classroom separately for official question practice.

Assessment and feedback strategy

  • Independent predictions precede each simulation.
  • Students justify one wrong multiple-choice distractor in writing.
  • Teacher verifies model limitations, not just numeric answers.
  • Repeat key pseudocode and binary ideas in later units.

Source and alignment notes

Continue through the course