AP Computer Science Principles study materials
AP Computer Science Principles study resources

AP Computer Science Principles cheat sheet

AP Computer Science Principles · Keep the key ideas within reach.

Quick reference

Creative Development

  • A program is an ordered set of instructions; a code segment is a portion of that program.

  • Iterative development: build a small version, test it, revise, repeat; each cycle is an iteration.

  • Incremental development: add one small piece of functionality at a time and test before adding more.

  • A procedure abstracts a set of steps behind a name so it can be called repeatedly without rewriting the steps.

  • Parameters are the input names in a procedure definition; arguments are the actual values supplied in a call.

  • Documentation records purpose, inputs, outputs, and constraints of a program or procedure for other programmers.

  • Software licenses (open source vs. proprietary) determine whether code may be reused, modified, or redistributed.

  • Pair programming divides work into a driver who types and a navigator who reviews, catching errors earlier.

Quick reference

Data

  • Binary uses base 2: each bit position is a power of 2, so n bits represent 2^n distinct values.

  • Bit, byte, kilobyte hierarchy: 8 bits = 1 byte; 1 kilobyte = 1024 bytes (or 1000 in decimal prefixes).

  • Lossless compression preserves all data and is reversible (e.g., PNG); lossy compression discards detail and is not reversible (e.g., JPEG).

  • Sampling rate and bit depth determine how faithfully analog data such as sound is captured in digital form.

  • Metadata is data about data (e.g., a photo's timestamp and location) and can reveal information not intended to be shared.

  • Cleaning data removes errors, duplicates, and outliers; filtering selects a subset of records for analysis.

  • A data table organizes records as rows and attributes as columns; a record is one complete row of related fields.

  • Correlation between two variables does not establish that one causes the other.

Quick reference

Algorithms and Programming

  • Sequencing runs statements in order; selection uses conditions (if/else); iteration repeats (for/while loops).

  • A Boolean expression evaluates to true or false; AND requires both operands true, OR requires at least one, NOT negates.

  • Linear search checks elements one by one (O(n)); binary search requires sorted data and halves the range each step (O(log n)).

  • Reasonable time: linear and binary search are reasonable; brute-force problems with exponential growth are not.

  • A procedure call passes arguments; values passed by value are copied, so changing the parameter does not alter the original variable.

  • A list (array) stores ordered elements accessed by index; traversal uses a loop to visit each element in turn.

  • An algorithm is a finite sequence of unambiguous steps that solves a problem; equivalent algorithms may differ in efficiency.

  • Debugging strategies: add output statements, test boundary cases, and trace variable values step by step.

Quick reference

Computer Systems and Networks

  • The Internet is a network of networks using TCP/IP; the World Wide Web is an application layer service running on it.

  • IP addresses identify devices; DNS translates human-readable domain names into IP addresses.

  • TCP guarantees ordered, reliable delivery by acknowledging packets and retransmitting lost ones; UDP is faster but unreliable.

  • Packet switching splits messages into packets routed independently, tolerating partial network failure.

  • Bandwidth is the maximum data rate of a link; latency is the delay for data to travel; both affect performance.

  • The fault-tolerant design of the Internet means no single device failure disables the whole network.

  • Sequential computing does one operation at a time; parallel computing distributes work across multiple processors.

  • Distributed computing splits a task across networked machines, improving speed but adding coordination overhead.

Quick reference

Impact of Computing

  • Computing innovations create benefits and harms; the same technology can have different effects on different groups.

  • Personally identifiable information (PII) is data that can identify an individual directly or by combination.

  • Encryption protects data in transit; symmetric uses one shared key, public-key uses a public/private key pair.

  • Phishing and social engineering exploit human trust rather than technical flaws; multifactor authentication reduces risk.

  • Open access and open source lower barriers to use but raise questions about support and sustainability.

  • Bias in data or algorithms can produce unfair outcomes, so datasets and models require scrutiny.

  • Digital divide: unequal access to computing devices and connectivity can widen existing social and economic gaps.

  • Legal and ethical concerns include intellectual property, privacy, and the societal consequences of automation.