Now readingIntroduction
0%
AP Computer Science A · Framework 2026-27
Unit 4

Data Collections

Collections organize many related values. Arrays provide fixed indexed storage, ArrayList provides a resizable sequence, and the assessed two-dimensional arrays form rectangular rows and columns.

Exam weight
30–40%
Topics
17

Introduction

Collections organize many related values. Arrays provide fixed indexed storage, ArrayList provides a resizable sequence, and the assessed two-dimensional arrays form rectangular rows and columns.

A sound collection algorithm derives its bounds from the exact accesses it performs and states what its accumulator means for processed data. Searching, sorting, recursion, file parsing, and responsible data use all depend on those same habits.

Current exam guidance: Aligned to the current 2026–27 AP Computer Science A framework and Java Quick Reference. The May 2027 digital exam has 42 multiple-choice questions in 90 minutes and four free-response questions in 90 minutes.
4.1

Ethical and Social Issues Around Data Collection

What makes a data-collection design responsible?

Short answer

Responsible collection ties each field to a legitimate purpose, limits exposure and retention, represents affected groups fairly, and communicates remaining risks.

Know firstProgram-design impacts · Arrays as stored values

Data choices determine who is visible and who is exposed

Before collecting data, define the decision it will support and ask whether each field is necessary. Aggregate counts may answer a space-planning question without storing names, device identifiers, or precise movement histories. Minimization lowers risk, but it does not erase it: small groups or unusual patterns can sometimes be reidentified.

Sampling and measurement also shape conclusions. Missing groups, inaccessible collection methods, proxy variables, and unequal error rates can make a technically correct analysis unfair or misleading. Document consent, provenance, access, retention, and deletion, then limit claims to the population and conditions actually represented.

Java trace

Compute a planning measure from anonymous counts

int[] occupiedSeats = {7, 11, 9, 6};
int peak = 0;
for (int count : occupiedSeats) {
  if (count > peak) peak = count;
}
System.out.println(peak);
Execution stateStep 1 of 4
interval
1
observedCount
7
peakAfter
7
identityStored
false
Open complete trace table
Complete trace states
StepintervalobservedCountpeakAfteridentityStored
1177false
221111false
33911false
44611false
Output
11

Four anonymous occupancy counts produce a peak of eleven; no person-level identity is needed for this calculation.

Review a collection plan

  1. State the decision or service the data supports.
  2. Justify every collected field.
  3. Identify people omitted, exposed, or affected by error.
  4. Set access, retention, and deletion limits.
  5. Match the conclusion to the represented population.

Keep these three ideas

  • Collect data for a stated purpose.
  • Minimize fields and retention.
  • Audit representation, access, and inference risk.

Keep reading Unit 4: Data Collections

You just read the first topic free. Your free trial opens the rest of this unit, every AP Computer Science A unit, and all 19 AP courses.

  • 4.1 Ethical and Social Issues Around Data CollectionRead
  • 4.2 Introduction to Using Data Sets
  • 4.3 Array Creation and Access
  • 4.4 Array Traversals
  • 4.5 Implementing Array Algorithms
  • 4.6 Using Text Files
  • 4.7 Wrapper Classes
  • 4.8 ArrayList Methods
  • 4.9 ArrayList Traversals
  • 4.10 Implementing ArrayList Algorithms
  • 4.11 2D Array Creation and Access
  • 4.12 2D Array Traversals
  • 4.13 Implementing 2D Array Algorithms
  • 4.14 Searching Algorithms
  • 4.15 Sorting Algorithms
  • 4.16 Recursion
  • 4.17 Recursive Searching and Sorting
Start my free 7 days →$0.00 due today · cancel anytime · score guarantee

Practice AP Computer Science A in the real test engine.

Free practice set: timed, the same engine as our full-length tests, every answer explained.