A quick self-test. Given this list:
colors ← ["red", "blue", "green", "gold"]
What is colors[2]?
If you've programmed in Python, JavaScript, or Java, every instinct says "green" — those languages start counting at 0. AP pseudocode starts at 1. colors[1] is "red", so colors[2] is "blue".
The exam writers know exactly which languages you've used, and they write distractors for your instincts. Every list question on the exam offers the 0-indexed answer as a choice. Retrain now: first element, index 1.
A list is an ordered collection of elements, each accessible by its index — its position, starting at 1.
scores ← [88, 92, 75, 99, 84]
| Expression | Value | Why |
|---|---|---|
scores[1] |
88 | First element — index 1 |
scores[4] |
99 | Fourth element |
LENGTH(scores) |
5 | Number of elements |
scores[LENGTH(scores)] |
84 | The last element — the standard idiom |
scores[6] |
💥 run-time error | No index 6 in a 5-element list |
Elements can be read and written: scores[3] ← 80 replaces 75 with 80. An index can be any expression: scores[i + 1] — evaluate the expression first, then index.
Accessing an index below 1 or beyond LENGTH causes a run-time error (Lesson 2's crash-on-certain-inputs, now with a cause you'll actually write).
Starting fresh each time from L ← [10, 20, 30]:
| Operation | Result | Rule |
|---|---|---|
APPEND(L, 40) |
[10, 20, 30, 40] | Adds to the end; length grows by 1 |
INSERT(L, 2, 15) |
[10, 15, 20, 30] | New element at index 2; everything from old index 2 onward shifts right |
REMOVE(L, 1) |
[20, 30] | Deletes element at index 1; everything after shifts left |
The shifting is where points are won: after INSERT(L, 2, 15), the value 20 — previously at index 2 — now lives at index 3. After a REMOVE, indexes of later elements each drop by 1. When a question chains operations, re-draw the list after every operation:
L ← [5, 8, 2]
APPEND(L, 9) → [5, 8, 2, 9]
REMOVE(L, 2) → [5, 2, 9]
INSERT(L, 1, 7) → [7, 5, 2, 9]
DISPLAY (L[2]) → displays 5
Suppose a gradebook program used separate variables: score1, score2, ..., score30. Now the class adds a student — you rewrite the program. Compute an average — thirty-term expression, written by hand.
A list replaces the mob of variables with one name managing many values. That's data abstraction, and the CED credits it with two specific powers:
scores) stands for the whole collection; the program says what to do with the collection, not each element by name.LENGTH(scores) and loops (Lesson 12) works unchanged whether there are 3 scores or 3,000. You can change the data without changing the code.That second sentence is nearly verbatim what Written Response 2(c) wants about your PT list. Learn it as a sentence-shape now: "Because my program refers to the list ___ rather than individual values, it works without modification when the number of ___ changes."
A string is an ordered sequence of characters: name ← "Ada". The CED requires two operations:
"sun" + "set" → "sunset" (some AP materials write CONCAT("sun", "set"); either way, joining). Order matters: "set" + "sun" → "setsun"."COMPUTER": positions 1–3 → "COM"; positions 4–6 → "PUT".Numbers vs. strings matters: "3" + "4" concatenates to "34"; 3 + 4 adds to 7. If a question mixes them, the type wins.
Problem: animals ← ["cat", "owl", "fox", "bee", "elk"]. Evaluate: (i) animals[3] (ii) animals[LENGTH(animals)] (iii) animals[LENGTH(animals) − 3]
Solution: (i) "fox" (1→cat, 2→owl, 3→fox). (ii) LENGTH = 5 → animals[5] = "elk". (iii) 5 − 3 = 2 → "owl" — evaluate the index expression first, then look up.
Interpretation: (i) catches 0-indexers (they say "bee"). If you said "bee," do twenty of these tonight.
Problem: What does this display?
L ← [4, 11, 4, 7]
REMOVE(L, 3)
APPEND(L, 2)
INSERT(L, 2, 9)
DISPLAY (L[3])
Strategy: Redraw the list after every line.
Solution:
Start: [4, 11, 4, 7]
REMOVE(L, 3): [4, 11, 7] (the 4 at index 3 gone; 7 shifts to index 3)
APPEND(L, 2): [4, 11, 7, 2]
INSERT(L, 2, 9): [4, 9, 11, 7, 2] (9 enters at 2; 11, 7, 2 shift right)
L[3] = 11 → displays 11
Interpretation: Four redraws, zero shortcuts. The distractors here are "7" (forgot INSERT shifts things) and "4" (misapplied REMOVE).
Problem: first ← "GRACE", last ← "HOPPER". A program builds code ← substring of first from position 1 to 2, concatenated with substring of last from position 5 to 6. What is code?
Solution: first positions 1–2 (inclusive) → "GR". last = H(1) O(2) P(3) P(4) E(5) R(6); positions 5–6 → "ER". Concatenated: "GRER".
Interpretation: Number the characters with your pencil before extracting — counting on faith produces off-by-one substrings, and yes, "GRPE" (positions 4–5) is among the choices when this appears.
Problem: A programmer replaces this:
total ← n1 + n2 + n3 + n4
with a list nums and code that sums the list (using a loop). Which is the BEST reason the list version is preferable?
(A) The list version runs faster (B) Lists use less memory than four variables (C) The list version works without code changes if the number of values changes (D) The original version contains a syntax error
Solution: (C) — data abstraction's change-resilience, the CED's stated benefit. (A)/(B) are unfounded micro-claims (and not CED reasoning); (D) is false — the original is valid, just brittle.
Interpretation: When the exam asks "why use a list," the answer is manage complexity / survive data-size changes — never speed or memory.
L[1]. The distractor one position off is ALWAYS offered. This mistake alone costs unprepared students 2–3 exam points.L[LENGTH(L) + 1] to read the last element. The last element is L[LENGTH(L)]; one past it is a run-time error. (Writing via APPEND is how you extend.)pets ← ["dog", "cat", "hen", "pig"]. What is pets[2]?1. (B). 1-indexed: 1→"dog", 2→"cat". (C) "hen" is the 0-indexed reflex answer — if you chose it, reread the warm-up.
pets list, which expression evaluates to "pig"?2. (A). LENGTH(pets) = 4 → pets[4] = "pig". (B) indexes past the end — run-time error. (C) index 0 doesn't exist here. (D) is "hen".
What is the list after this code?
L ← [3, 6, 9]
INSERT(L, 2, 5)
3. (A). INSERT at index 2: 5 takes position 2; 6 and 9 shift right → [3, 5, 6, 9]. (B) inserted after index 2; (C) inserted at the front; (D) overwrote instead of shifting.
What is the list after this code?
L ← [8, 1, 6, 2]
REMOVE(L, 2)
APPEND(L, 4)
4. (A). REMOVE index 2 (the 1): [8, 6, 2]. APPEND 4: [8, 6, 2, 4]. (B) removed by value position confusion (took the 2 out); (D) appended into the wrong slot.
REMOVE(L, 1) runs on a list of length n (n ≥ 2), the element previously at index 3 is now at index:5. (C). Everything after the removed element slides one left: old index 3 → new index 2.
What does this display?
words ← ["hot", "cold", "warm"]
words[1] ← words[3]
DISPLAY (words[1] + words[2])
6. (B). words[1] ← words[3] copies "warm" into position 1 → ["warm", "cold", "warm"]. Then words[1] + words[2] = "warm" + "cold" = "warmcold". (A) forgets the assignment ever happened; (D) is the trap for assuming the assignment also changed words[2] — it touched only position 1.
word ← "ALGORITHM". The substring from position 3 to position 5 (inclusive) is:7. (A). A(1) L(2) G(3) O(4) R(5) → positions 3–5 inclusive = "GOR". (B) starts at 2 (off-by-one); (D) starts at 4; (C) takes four characters.
8. (B). One name, whole collection — the CED's definition of managing complexity via data abstraction. The rest are invented powers.
LENGTH(temps) in its loops. Next year the dataset grows to 366 days. What must change in the code?9. (C). The point of LENGTH(temps)-driven code: data changes, code doesn't. This is Example 4's principle inverted into a scenario.
10. (A) and (C). APPEND and INSERT each add an element (+1 length). REMOVE shortens; assignment to L[i] replaces in place (same length).
What does this display?
L ← [2, 4, 6, 8, 10]
i ← 2
DISPLAY (L[i + 2])
11. (B). i + 2 = 4 → L[4] = 8. (A) is L[3] (index-expression slip); (C) is L[i] itself.
L[7]. The result is:12. (D). Out-of-range access halts the program — run-time error (Lesson 2 vocabulary, list edition). (A) wrapping is a Python-ism (negative indexes) that AP pseudocode does not have.
Answer letter distribution check: B, A, A, A, C, B, A, B, C, A+C, B, D — singles: A×4, B×4, C×2, D×1 + multi (A,C). Note: problem 6's key was corrected during self-verification (D → B); the reasoning stands in the key. Cumulative letter spread through L8 ≈ A 24%, B 33%, C 22%, D 21%.
This is the most PT-loaded lesson in the course. The Create PT requires your program to use a list (or other collection) that manages complexity — and your Personalized Project Reference must include screenshots of (i) where the list is created or initialized and (ii) where it's used. Written Response 2(c) then asks you to explain it.
The winning explanation has exactly this lesson's shape:
"My program stores ___ in the list
___. Because the code processes the list with loops andLENGTH, it handles any number of entries without modification — without the list, I would need a separate variable for every ___ and would have to rewrite the program whenever the count changed."
Do this now: take one idea from your PT idea list (Lesson 6) and write its version of that paragraph with real names. If you can't name what the list holds, the idea isn't PT-ready yet — fix that before Lesson 14, where you'll add the required procedure.
1. (B). 1-indexed: 1→"dog", 2→"cat". (C) "hen" is the 0-indexed reflex answer — if you chose it, reread the warm-up.
2. (A). LENGTH(pets) = 4 → pets[4] = "pig". (B) indexes past the end — run-time error. (C) index 0 doesn't exist here. (D) is "hen".
3. (A). INSERT at index 2: 5 takes position 2; 6 and 9 shift right → [3, 5, 6, 9]. (B) inserted after index 2; (C) inserted at the front; (D) overwrote instead of shifting.
4. (A). REMOVE index 2 (the 1): [8, 6, 2]. APPEND 4: [8, 6, 2, 4]. (B) removed by value position confusion (took the 2 out); (D) appended into the wrong slot.
5. (C). Everything after the removed element slides one left: old index 3 → new index 2.
6. (B). words[1] ← words[3] copies "warm" into position 1 → ["warm", "cold", "warm"]. Then words[1] + words[2] = "warm" + "cold" = "warmcold". (A) forgets the assignment ever happened; (D) is the trap for assuming the assignment also changed words[2] — it touched only position 1.
7. (A). A(1) L(2) G(3) O(4) R(5) → positions 3–5 inclusive = "GOR". (B) starts at 2 (off-by-one); (D) starts at 4; (C) takes four characters.
8. (B). One name, whole collection — the CED's definition of managing complexity via data abstraction. The rest are invented powers.
9. (C). The point of LENGTH(temps)-driven code: data changes, code doesn't. This is Example 4's principle inverted into a scenario.
10. (A) and (C). APPEND and INSERT each add an element (+1 length). REMOVE shortens; assignment to L[i] replaces in place (same length).
11. (B). i + 2 = 4 → L[4] = 8. (A) is L[3] (index-expression slip); (C) is L[i] itself.
12. (D). Out-of-range access halts the program — run-time error (Lesson 2 vocabulary, list edition). (A) wrapping is a Python-ism (negative indexes) that AP pseudocode does not have.
Answer letter distribution check: B, A, A, A, C, B, A, B, C, A+C, B, D — singles: A×4, B×4, C×2, D×1 + multi (A,C). Note: problem 6's key was corrected during self-verification (D → B); the reasoning stands in the key. Cumulative letter spread through L8 ≈ A 24%, B 33%, C 22%, D 21%.
Exam tip: The moment a code question involves a list, write the list horizontally on scratch paper with index numbers 1, 2, 3... above each element — before reading the operations. Then execute operations pencil-first. The exam's list questions are designed so that students who track indexes on paper get them right and students who track them mentally reliably don't.