AP CS P Cram Sheet
High-impact concepts, traps, and visual aids across all five Big Ideas. The non-obvious things that decide your score.
- Iterative refines the same thing through cycles; incremental builds the program in small working pieces added one at a time.
- Error types: syntax won't run, runtime crashes during execution, logic runs but gives wrong output, overflow is a value too large for the bits.
- The number of distinct values representable in n bits is 2n.
- Lossless (ZIP, PNG, FLAC) is exactly recoverable; lossy (JPEG, MP3, MP4) discards data and is not recoverable.
- AP CSP pseudocode lists are 1-indexed: the first element is
aList[1], notaList[0]. - In pseudocode
=is a comparison, not assignment; assignment uses←. - Binary search requires sorted data, and on 1024 elements takes at most about 10 checks versus up to 1024 for linear.
- RANDOM(a, b) returns an integer in the range [a, b] inclusive on both ends.
- MFA needs two or more independent factor categories; two passwords are the same factor and do not count.
- A certificate authority is a trusted third party that verifies a website's identity and digitally signs a certificate for its public key.
1Creative Development · BI1
Iterative development cycle
Software is built by cycling through investigation, design, prototyping, and testing — not by completing each step once and moving on. Any step can return to any earlier step when new information arises.
Incremental development
Incremental means building the program in small, working pieces — each piece adds new functionality on top of what's already working. Different from iterative (which refines the same thing). The exam often uses them together: "iterative and incremental development."
Iterative = same thing, refined through cycles (improve the search algorithm three different ways). Incremental = different pieces, added one at a time (add search, then sort, then filter). Most real software does both.
Collaboration
Collaboration produces programs that better reflect the needs of all users — diverse perspectives reduce embedded bias and catch errors a solo programmer would miss.
- Brainstorming — generate many ideas before evaluating any
- Code review — peers read each other's code for bugs, clarity, edge cases
- User feedback — test on real users early; assumptions break in contact with reality
- Pair programming — see below
Pair programming
Two programmers, one keyboard. Roles are explicit and they switch periodically.
Catches bugs earlier (two readers), spreads knowledge across the team (no single owner of a module), and produces more thoughtful design (you have to explain decisions out loud). Trade-off is the obvious one: two people on one task. Used selectively — for complex modules, onboarding, and tricky debugging.
Program components
| Input | data entering the program — keyboard, mouse, touch, sensors, files, network |
| Output | data leaving — screen, sound, motor, file write, network send |
| Behavior | how the program responds to inputs |
| Purpose | the problem the program is built to solve |
Error types
| Syntax | code violates language rules — program won't run at all |
| Runtime | crash during execution (divide by zero, bad list index, null reference) |
| Logic | runs fine, but produces the wrong output — hardest to find |
| Overflow | value too large to represent in the allotted bits |
Testing & debugging
- Test cases must cover typical + edge (empty, max, min, boundary) + invalid input
- Debugging cycle: identify → isolate → fix → retest. Then add the failing input as a permanent test case
- Comments explain why, not what — code already shows what
- Procedures & abstractions aid reuse and make code easier to test in isolation
A program that passes the test cases you wrote may still fail on inputs you didn't think to test. Edge cases the spec doesn't mention are where logic errors hide. Always ask: "what is the simplest input?" and "what is the weirdest?"
2Data · BI2
Bits, bytes, abstraction
A bit is a 0 or 1. Eight bits = one byte. Everything in a computer — numbers, text, images, sound — is built up from bits through layers of abstraction. The number of distinct values representable in n bits is 2n.
Binary → Decimal · place-value method
Each bit position represents a power of 2. To convert a binary number to decimal: identify each 1 bit, add up the place values.
Decimal → Binary · divide-by-2 method
To convert decimal to binary: divide by 2 repeatedly, write down each remainder, then read the remainders from bottom to top. Stop when the quotient reaches 0.
Use place-value when converting binary → decimal (you read bit positions and add). Use divide-by-2 when converting decimal → binary (you build the bits from the bottom up). Trying to use place-value to find the binary of an arbitrary decimal is slow; trying to use divide-by-2 to read a binary number is unnecessary.
Number representation limits
- Overflow — a calculation produces a number too large to store in the allotted bits. The top bits get lost; the result wraps around or saturates.
- Round-off — some real numbers can't be represented exactly in binary (e.g. 0.1 has an infinite binary expansion). Computations on them carry tiny errors that can accumulate.
- Fixed bit widths impose both a maximum range and finite precision.
Analog → Digital · sampling
Real-world signals (sound, temperature, light) are analog — continuous, with infinite values between any two points. Computers can only store digital data — discrete numbers. To go from analog to digital, we sample the analog signal at regular intervals and record each measurement as a number.
Sampling rate is measured in hertz: 1 Hz = 1 sample per second. CD-quality audio samples at 44,100 Hz (also written 44.1 kHz) — the signal is measured 44,100 times per second. Higher Hz means more faithful reproduction and a larger file size. Images use the analogous idea per area: more pixels per inch = higher resolution.
Compression
| Type | Examples | How |
|---|---|---|
| Lossless | ZIP, PNG, FLAC | Encodes the same information more compactly. The original is exactly recoverable. |
| Lossy | JPEG, MP3, MP4 | Discards data the human eye/ear is least likely to notice. The original is not recoverable; the file is much smaller. |
Use lossless for text, code, archives, medical images — anything where bit-for-bit fidelity matters. Use lossy when small file size beats perfect fidelity (consumer audio, video, photos). The exam likes to ask which is appropriate given a scenario.
Information from data
Metadata is data about data — file size, author, GPS coordinates, timestamp, format. It travels with the data and helps with organization, searching, and provenance.
Extraction pipeline: Clean (fix missing/invalid records) → Filter → Sort → Transform → Visualize. Bigger datasets reveal more patterns but cost more to store, process, and secure. Correlation is not causation.
Bias in data
Data is never neutral. Bias enters through:
- Collection — who or what gets measured, what gets missed (sampling gaps)
- Cleaning — which records are dropped or fixed
- Encoding — which categories are chosen, which defaults are assumed
A large dataset can amplify existing bias rather than erase it. If the source pipeline is biased, scale only entrenches the pattern.
3Pseudocode & Control Flow · BI3
AP CSP uses its own pseudocode — language-agnostic, with ← for assignment and braces for blocks. The reference sheet is provided on the exam, but knowing each construct by sight saves time.
Variables & assignment
a ← expression // assign value of expression to variable a
count ← 0
name ← "Minsang"
flag ← true
Types are inferred: integer, decimal, string, boolean, list. Strings concatenate with + or CONCAT. Scope: variables declared inside a procedure (including parameters) are local to that procedure.
Lists are 1-indexed (!)
AP CSP pseudocode uses 1-based indexing — the first element is aList[1], not aList[0]. This is the single biggest source of off-by-one errors on the exam.
INSERT(aList, i, value) // insert value at position i, shifting later elements right
APPEND(aList, value) // add value to end of list
REMOVE(aList, i) // remove element at position i, shifting later elements left
LENGTH(aList) // returns number of elements
Starting a list traversal at index 0 in AP CSP pseudocode reads before the list. Starting at 1 and going through LENGTH(aList) inclusive is the correct range.
Boolean logic & truth tables
| a | b | a AND b | a OR b | NOT a |
|---|---|---|---|---|
| T | T | T | T | F |
| T | F | F | T | F |
| F | T | F | T | T |
| F | F | F | F | T |
Comparison operators: =, ≠, <, ≤, >, ≥. Note that = in pseudocode is a comparison, not assignment — assignment uses ←.
Selection · IF / ELSE
IF (count > 10)
{
DISPLAY("many")
}
ELSE
{
DISPLAY("few")
}
Nested IFs handle multiple cases. Conditions are evaluated top to bottom — order matters when conditions overlap.
Three iteration patterns
Known count · REPEAT n TIMES
REPEAT 5 TIMES
{
DISPLAY("hello")
}
Use when you know exactly how many iterations are needed up front.
Condition-controlled · REPEAT UNTIL
REPEAT UNTIL (count ≥ 100)
{
count ← count + 1
}
Loops until the condition becomes true. The condition is checked at the start of each iteration.
List traversal · FOR EACH
FOR EACH item IN aList
{
DISPLAY(item)
}
Iterates through every element of a list in order. item takes the value of each element in turn.
If the condition in REPEAT UNTIL never becomes true, the loop runs forever. Most commonly: forgetting to update the variable being tested inside the loop body.
Procedures
PROCEDURE findMax(numbers)
{
max ← numbers[1]
FOR EACH n IN numbers
{
IF (n > max)
{
max ← n
}
}
RETURN(max)
}
Parameters are inputs to the procedure (passed in by the caller). Return value is the output (optional). The body uses parameters as local variables.
Procedures hide how. A caller only needs to know what the procedure does and what arguments to pass — not the internal logic. This is the heart of managing complexity in software.
Robot commands & grid
The robot lives on a rectangular grid. It always has an orientation (the direction it's currently facing). All movement and turning is relative to that orientation.
MOVE_FORWARD() // step one square in current facing direction
ROTATE_LEFT() // turn 90° counter-clockwise
ROTATE_RIGHT() // turn 90° clockwise
CAN_MOVE(direction) // returns true if robot can move in direction
// direction ∈ {forward, backward, left, right}
// (relative to robot, NOT to grid)
CAN_MOVE(left) doesn't mean "can the robot move toward the west side of the grid?" — it means "is the square to the robot's own left open?" If the robot is facing south, the robot's left is the grid's east. Always recheck orientation after every ROTATE.
4Algorithms & Efficiency
Building blocks of every algorithm
Every algorithm, no matter how complex, is built from exactly three primitive operations:
- Sequencing — step after step, in order
- Selection — IF / ELSE, choosing between paths
- Iteration — loops, repeating actions
Equivalent algorithms are two different algorithms that always produce the same result for the same inputs — even if their internal steps differ.
Linear search vs binary search
If the array isn't sorted, binary search may report "not found" even when the target exists, or return a wrong position. On a list of 1024 elements: linear takes up to 1024 checks, binary takes at most about 10. The savings grow with size.
Efficiency · reasonable vs unreasonable
| Class | Growth | Reasonable? |
|---|---|---|
| Polynomial | n, n², n³, … | Reasonable — scales with effort |
| Exponential / factorial | 2ⁿ, n! | Unreasonable — intractable for large n |
Undecidable problem: no algorithm exists that gives a correct yes/no answer for every possible input. A famous example is the halting problem.
Heuristic: an approximate solution. Trades guaranteed correctness for speed when the exact answer is too slow to compute.
Common loop patterns
The vast majority of algorithm questions reduce to one of these four shapes. Recognize the pattern, trace the accumulator.
Sum
total ← 0
FOR EACH x IN aList
{
total ← total + x
}
Count (with a condition)
count ← 0
FOR EACH x IN aList
{
IF (x > 10)
{
count ← count + 1
}
}
Max / min (running best)
best ← aList[1]
FOR EACH x IN aList
{
IF (x > best)
{
best ← x
}
}
Filter (build a new list)
result ← []
FOR EACH x IN aList
{
IF (test(x))
{
APPEND(result, x)
}
}
Other algorithm concepts
- Simulation — models a real-world process when the real thing is too expensive, slow, dangerous, or impractical (weather, pandemics, traffic, evolution)
RANDOM(a, b)— returns an integer in the range[a, b]inclusive on both ends- Libraries & APIs — pre-built procedures provided for reuse; use the abstraction without knowing the internals
Parallel vs distributed computing
| Parallel | One task, multiple processors, same machine. Speeds up CPU-bound work. |
| Distributed | Multiple machines, often geographically separate, cooperating over a network. Adds fault tolerance through redundancy. |
Speedup
speedup = sequential_time / parallel_time
Parallel time is bounded by the longest portion that cannot be parallelized plus the parallelizable work divided across processors. Adding more processors gives diminishing returns — the sequential portion becomes the bottleneck.
5Computer Systems & Networks · BI4
Internet vs Web
| Internet | Global network of networks — the infrastructure. Made of cables, routers, ISPs, satellites, fiber. |
| World Wide Web | A service on top of the Internet. Uses HTTP. Just one of many applications running over the Internet. |
Email, video calls, online games, file transfers — all use the Internet but are not the Web.
Packet routing & fault tolerance
When you send data across the Internet, it's broken into packets. Each packet is routed independently and may take a different path. They're reassembled at the destination.
- Fault tolerance — multiple available paths mean one failed router doesn't break the connection. The system routes around damage.
- Redundancy — having more components than strictly necessary. The source of fault tolerance.
Protocols · the rules of communication
| Name | Purpose |
|---|---|
| IP | Addresses devices and routes packets |
| TCP | Reliable, ordered delivery; retransmits lost packets |
| UDP | Faster, no retransmit; used for video calls and games where speed beats reliability |
| HTTP / HTTPS | Web requests · the S = encrypted with TLS |
| DNS | Translates human names to IP addresses (example.com → 93.184.216.34) |
Internet protocols are open standards — anyone can implement them, no permission needed. This is why the Internet scales: a new device, app, or company can plug in without negotiating with a central authority. Open standards are the reason the Internet works.
Bandwidth vs latency
A satellite link can have huge bandwidth but big latency (signal travels far). Fiber can have low latency but limited bandwidth on an underprovisioned segment. They measure different things and trade off independently.
Scalability
A system is scalable when it adapts to handle increased load (more users, more data, more traffic) without redesign. The Internet's packet model + open standards + redundancy together make it scale to billions of devices — adding capacity in one region doesn't require redesigning the whole network.
6Impact of Computing · BI5
Beneficial & harmful effects
The same technology often produces both effects — the exam expects you to identify both sides.
| Technology | Beneficial | Harmful |
|---|---|---|
| GPS | navigation | surveillance, location tracking |
| Social media | connection across distance | misinformation, addiction |
| AI / automation | efficiency, scale | job displacement, embedded bias |
Effects can be intended or unintended, and local or global.
Digital divide
Digital divide = unequal access to computing technology along lines of geography, income, age, education, or disability. The exam treats it as a major contributor to inequality of opportunity.
Computing bias
Algorithms produce biased outcomes when bias is embedded in:
- The training data (who's represented, who isn't)
- The design choices (what to measure, what to optimize for)
- The developer's assumptions (defaults, edge cases)
Bias can be intentional or unintentional. Bias exists even in carefully tested systems.
Crowdsourcing & citizen science
- Crowdsourcing — obtaining input, ideas, or work from a large distributed group, often online (Wikipedia, Kickstarter, OpenStreetMap).
- Citizen science — non-scientists contribute data or observations to research projects (eBird, Foldit, Zooniverse).
Legal & ethical
- Copyright protects original work; violation = infringement
- Creative Commons = licenses letting creators grant specific permissions
- Open source = source code is freely available to use, modify, and redistribute
- Plagiarism = using someone else's code or text without proper credit. Always cite sources.
PII & privacy
Personally Identifiable Information (PII): name, SSN, address, photo, birthdate, biometric data, IP address, location.
Individually harmless data — name, ZIP code, birthdate — can uniquely identify someone when combined. Anonymization that strips only obvious identifiers often fails. Privacy settings, anonymization, and minimizing data collection together reduce risk.
Threats
| Threat | What it does |
|---|---|
| Phishing | fake message tricks the user into revealing information |
| Malware | malicious software (general term covering the rest) |
| Keylogger | records keystrokes secretly |
| Rogue access point | fake Wi-Fi to intercept traffic |
| Virus / worm | self-replicating malware that spreads to other machines |
Encryption · symmetric
Both parties share the same secret key. Fast and simple, but requires a prior secure exchange of the key.
Encryption · public key (asymmetric)
Two mathematically linked keys per person: a public key (anyone may have it) and a private key (never shared). Data encrypted with one can only be decrypted with the other.
Public-key crypto solves the key distribution problem: B can publish her public key on the open Internet, and anyone — including a complete stranger — can send her an encrypted message that only she can read. No prior secret exchange required. This is what makes HTTPS work for first-time visitors to a website.
Multi-factor authentication (MFA)
Two or more independent factors must verify identity. The three factor categories:
- Something you know — password, PIN
- Something you have — phone, hardware token
- Something you are — fingerprint, face, voice
Two passwords are not MFA — they're the same factor category.
Certificate authorities
A certificate authority (CA) is a trusted third party that verifies the identity of a website and digitally signs a certificate attesting that "this public key really belongs to example.com." Your browser ships with a list of CAs it trusts. This is what makes the padlock in HTTPS meaningful — without CAs, public-key crypto can't tell you whose public key you're using.
7Pseudocode Reference Card
The College Board provides this sheet during the exam, but knowing each construct by sight saves you trips to the back of the test booklet.
Assignment & math
a ← expression | assign value of expression to a |
a + b, a − b | sum, difference |
a * b, a / b | product, quotient (float division) |
a MOD b | remainder when a is divided by b |
Comparison & boolean
=, ≠ | equal, not equal (comparison; not assignment) |
<, ≤, >, ≥ | relational comparisons |
NOT, AND, OR | logical operators |
true, false | boolean literals |
Lists (1-indexed!)
aList[i] | element at position i (first element is i = 1) |
LENGTH(aList) | number of elements in the list |
INSERT(aList, i, value) | insert value at position i, shifting later elements right |
APPEND(aList, value) | add value to the end of the list |
REMOVE(aList, i) | remove element at position i, shifting later elements left |
Selection & iteration
IF (cond) { } | execute block if condition is true |
IF (cond) { } ELSE { } | two-way branch |
REPEAT n TIMES { } | known-count loop |
REPEAT UNTIL (cond) { } | condition-controlled loop |
FOR EACH x IN aList { } | list traversal |
Procedures
PROCEDURE name(p) { } | define a procedure with parameter p |
RETURN(value) | return a value from the procedure |
name(arg) | call a procedure with an argument |
Robot
MOVE_FORWARD() | move one square in current facing direction |
ROTATE_LEFT() | turn 90° counter-clockwise (relative to robot) |
ROTATE_RIGHT() | turn 90° clockwise (relative to robot) |
CAN_MOVE(direction) | true if robot can move in direction · direction ∈ {forward, backward, left, right} |
Other
RANDOM(a, b) | random integer in [a, b], inclusive on both ends |
DISPLAY(expr) | output the value of expr |
INPUT() | get input from the user |
8Exam-Day Tips
Strategy
- Read every choice before committing — the "obviously right" first option is often a subtly wrong distractor
- No penalty for wrong answers — never leave a question blank. Eliminate then guess
- Time check at Q20 and Q40 — Section I is 120 minutes for 70 questions, so you have about 1 minute 40 seconds each. Bank the easy ones fast and you will have 20+ minutes to return to flagged questions
- Eliminate before guessing — on a single-select question typically 2 of the 4 choices are clearly wrong
- Watch for multi-select — 8 of the 70 questions ask you to select TWO answers, and they come last. Both must be right to earn the point, so treat each option as its own true/false decision
- Flag-and-move on hard questions; return after easier ones are banked
Code traces
- Write each variable's value in the margin after every assignment
- For nested loops, track both loop counters in a small grid
- For procedure calls, substitute the argument values for the parameters mentally before tracing the body
- For
RETURNstatements, write the returned value next to the call site
Robot grids
- Sketch the grid; mark the obstacles and the robot's starting position + orientation
- After every
ROTATE, redraw the orientation arrow before continuing - Remember:
CAN_MOVEdirection is relative to the robot, not the grid - Track the robot's state (position + orientation) after each command, not just position
Common traps
aList[0]— off-by-one, lists start at 1- Inclusive vs exclusive bounds —
RANDOM(a, b)is inclusive both ends - "At least" vs "exactly" in MCQ wording — they ask different things
- Order of conditions in nested IF — first true branch wins, later overlapping conditions never run
- Forgetting to update the loop variable in
REPEAT UNTIL— infinite loop
Vocabulary check (these words show up constantly)
| Redundancy | multiple copies / paths (the source of fault tolerance, not its synonym) |
| Fault tolerance | continues working despite component failure |
| Scalable | handles growth without redesign |
| Abstraction | hides implementation detail behind a simpler interface |
| Heuristic | approximate solution; trades accuracy for speed |
| Equivalent algorithms | different code, same result for all valid inputs |
Most questions are about recognizing the pattern, not inventing something clever. If you've seen the four loop shapes, the three iteration patterns, the two search algorithms, and the three error types, you've already seen the answers to 80% of the multiple-choice section. Good luck.
9Section II & the Written Responses
Section I — 70 multiple-choice questions, 120 minutes, 70% of your score: 57 single-select, 5 single-select built on a reading passage about a computing innovation, and 8 multi-select. Section II — the Create performance task (program code, video, and Personalized Project Reference) together with the written responses, 30%.
The Personalized Project Reference
You write the PPR yourself during the 9 hours of class time for the Create task, and you answer the written responses with it in front of you. It contains a Procedure section — part (i) your procedure's code, part (ii) a call to it — and a List section showing your list being built and used.
Your PPR has to be submitted as final in the AP Digital Portfolio by the deadline. If it was not, your written responses do not count toward your score at all.
The four prompts
The College Board writes several prompt sets and rotates them, so you will not know your exact wording in advance. What stays fixed is each prompt's type, the part of your PPR it points at, and its 1 point. The prompts below are examples from released sets; yours will ask something of the same type.
| WR 1 Program Design, Function & Purpose | Your program as a whole: who it is for, what goes in, what comes out, what it does. Examples: identify an example output and explain how it shows your program's functionality · identify an invalid or unexpected input and describe what the program does with it · identify the expected users and explain how the program addresses one of their concerns or interests. |
| WR 2(a) Algorithm Development | The selection or iteration in your Procedure section, usually the first one. Examples: identify the Boolean expression in the first selection statement, give values that make it true (another set: false), and explain why · describe what the body of the first iteration statement accomplishes. |
| WR 2(b) Errors & Testing | Changing or calling the procedure in part (i). Depending on the set, it asks for a logic error (the program runs but behaves wrongly) or a run-time error (it fails while running), or for test calls. Examples: describe a change another programmer could make that causes a logic error, and how the procedure's behavior would change · give two calls that make different code segments in the procedure run, and describe what each does. Answer with the kind of error or test your prompt names. |
| WR 2(c) Data & Procedural Abstraction | Your List section, or your procedure as an abstraction. Examples: explain how the code that uses your list would have to change if several elements were added to the end, or why no change is needed · explain how your procedure's parameter(s) manage complexity · using a procedure the prompt supplies (one set gave checkValidity), explain in detailed steps an algorithm that works on your list, clear enough for someone else to code. |
Every prompt is anchored to your own program — a generic answer scores zero even when it is correct in general. Quote the variable, procedure and list names from your PPR, and answer every part the prompt asks: if it wants values and the reason, give both; if it wants a change and its effect, give both.
Describe = say what it is. Explain = say why or how. A response that describes where an explanation was asked for is the most common way to lose an easy point.