AP Computer Science Principles Reference Cheat Sheet
A printable reference covering algorithms, variables, conditionals, loops, lists, procedures, binary, data, internet, cybersecurity, and impacts for grades 10-12.
Related Tools
Related Labs
Related Worksheets
AP Computer Science Principles covers the big ideas behind computing, including algorithms, programming, data, the internet, cybersecurity, and the effects of technology on society. This cheat sheet gives students a quick reference for the concepts and rules that appear often on the AP exam. It is useful for reviewing vocabulary, tracing code, comparing algorithms, and checking common formulas. Students can use it while practicing multiple choice questions, performance task planning, or general programming review. The most important ideas include how programs store values, make decisions, repeat actions, and organize data in lists. Students should know how to read pseudocode, evaluate Boolean expressions, and describe how procedures use parameters and return values. They should also understand binary representation, metadata, data compression, packets, protocols, and basic cybersecurity practices. Strong AP CSP answers connect technical details to purpose, efficiency, correctness, and real-world impact.
Key Facts
- A variable stores one value at a time, and assignment updates it, as in score <- score + 1.
- A conditional runs code only when a Boolean expression is true, using the structure IF condition THEN action ELSE other action.
- A loop repeats steps, and a FOR EACH item IN list loop processes every element in a list one at a time.
- List indexing in AP CSP pseudocode starts at 1, so the first element is list[1] and the last element is list[LENGTH(list)].
- A procedure can use parameters as input values, and a RETURN statement sends one result back to the part of the program that called it.
- A binary number with n bits can represent 2^n different values, so 8 bits can represent 256 possible values.
- The internet sends data as packets, and protocols such as IP, TCP, DNS, and HTTP define rules for addressing, routing, reliability, naming, and web communication.
- Lossless compression preserves all original data, while lossy compression removes some data to reduce file size.
Vocabulary
- Algorithm
- A step-by-step process that solves a problem or completes a task.
- Abstraction
- A simplified representation that hides details so a programmer can focus on the important parts of a problem.
- Boolean Expression
- An expression that evaluates to either true or false, often using operators such as AND, OR, and NOT.
- Parameter
- A named input used inside a procedure to let the same code work with different values.
- Metadata
- Data that describes other data, such as a file name, date created, location, author, or image size.
- Protocol
- An agreed set of rules that computers use to communicate over a network.
Common Mistakes to Avoid
- Confusing assignment with comparison is wrong because x <- 5 changes the value of x, while x = 5 checks whether x is equal to 5.
- Starting AP CSP list positions at 0 is wrong because AP CSP pseudocode uses 1-based indexing, so list[1] is the first element.
- Using OR when AND is required gives the wrong logic because OR is true when at least one condition is true, but AND requires both conditions to be true.
- Forgetting to update a loop control variable can create an infinite loop because the stopping condition may never become true.
- Claiming encryption prevents all cyberattacks is wrong because encryption protects data confidentiality, but it does not stop phishing, weak passwords, malware, or social engineering.
Practice Questions
- 1 A binary code uses 6 bits. How many different values can it represent?
- 2 Trace the code: x <- 3, y <- 2, x <- x + y, y <- x * 2. What are the final values of x and y?
- 3 A list contains [4, 7, 2, 9]. What value is stored at list[2] in AP CSP pseudocode, and what is LENGTH(list)?
- 4 Explain why using a procedure with parameters is an example of abstraction, and describe one benefit it gives a programmer.