5m left·0%
Reading Time: 5 min
Last Updated: March 2, 2026
Main Ideas: 4
Reading Time: 5 min
Last Updated: March 2, 2026
Main Ideas: 4

Topic 3.2 Notes – Data Abstraction

Verified for 2027 AP® Computer Science Principles Exam
Read aloud
You learn how to represent collections of data with a single variable, how indexing works in AP pseudocode, and why using a list actually makes programs simpler, more flexible, and easier to maintain.

1. What Lists and Strings Are

Lists

A list is an ordered sequence of elements.

In AP pseudocode, it looks like this:

scores ← [88, 92, 79, 95]

That means:

  • The list is stored in the variable scores.
  • Each value inside the brackets is an element.
  • Order matters.
    • scores[1] is 88
    • scores[2] is 92
    If you swap values, it’s a different list.

A list can contain different types of elements, such as:

mixed ← ["Alex", 11, true]

Each individual value inside the list is an element.

Index and Elements

Every element has an index, which is its position in the list.

In AP CSP:

  • Indexing starts at 1, not 0.
  • Valid indices go from 1 to LENGTH(list).
  • If you try to access index 0 or something bigger than the list length → error and program terminates.

This trips people up on quizzes. If a list has 4 elements, index 5 is not ignored. The program stops.

Strings

A string is an ordered sequence of characters.

name ← "Maya"

You can reference characters by index:

  • name[1] is "M"
  • name[4] is "a"

On the AP exam, treat a string like a special kind of list of characters. Same indexing rules apply.

2. Creating and Assigning Lists in AP Pseudocode

You need to know the exact reference sheet notation.

Creating a list with values

aList ← [value1, value2, value3]
  • value1 is at index 1
  • value2 is at index 2

Creating an empty list

aList ← []

This creates a list with no elements.

Assigning one list to another

aList ← bList

This assigns a copy of bList to aList.

If:

bList ← [20, 40, 60]
aList ← bList

Then both contain [20, 40, 60].

The exam expects you to know that this creates a copy. We are not dealing with advanced memory references in CSP.

Also, lists may be called arrays in other languages.
Linked lists are not part of this course.

3. Data Abstraction

Now the bigger idea.

Data abstraction means representing complex data with a single name while hiding the details of how it’s stored.

Instead of this:

score1 ← 88
score2 ← 92
score3 ← 79
score4 ← 95

You do this:

scores ← [88, 92, 79, 95]

Now scores represents the entire collection.

Data abstraction creates a separation between:

  • The abstract idea → “a collection of scores”
  • The concrete details → the individual numbers and their positions

You can work with the list as one unit instead of managing every variable separately.

Lists are one way to create data abstraction in CSP.

4. How Lists Manage Complexity

This is the part you’ll have to explain in words on tests and in the Create task.

Group Related Data

  • All related values are stored together.
  • One variable represents many pieces of data.

Reduce Redundancy

Instead of:

name1, name2, name3, name4

You use:

names ← [...]

Cleaner. Fewer variables. Less repetition.

Make Programs Easier to Modify

If you add a new value:

scores ← [88, 92, 79, 95, 100]

You don’t need to redesign your whole program structure.

Improve Readability

A meaningful list name communicates purpose:

  • inventory
  • studentAges
  • temperatures

Anyone reading the code understands the data instantly.

Support General Solutions

Lists allow programs to work for any number of elements.

That’s huge. Instead of writing code that works for exactly 4 scores, you can write code that works for 4, 40, or 400.

That scalability idea is something the AP exam likes to test indirectly.

Key Takeaways

A list is an ordered sequence of elements stored in a single variable.
In AP pseudocode, list indexing starts at 1 and going outside the range causes the program to terminate.
A string is an ordered sequence of characters and follows the same indexing rules.
aList ← bList assigns a copy of the list, not a reference you need to worry about.
Data abstraction hides the internal details of data and lets you treat a collection as one unit.
Lists manage complexity by grouping related data and allowing scalable, general solutions instead of hardcoded variables.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse this website.

Notes

1 credit used · 5/5 remaining