AP Computer Science Principles (CSP) Comprehensive Review

Big Idea 1: Creative Development and Collaboration

  • Computing Innovations     - Definition: A computing innovation must include a program as a major part of its function.     - Types of Innovations:         - Physical: For example, a self-driving car.         - Software: For example, various types of computer programs.
  • Collaboration in Programming     - Purpose: Collaboration provides diverse viewpoints and talent in the design process.     - Bias Reduction: It helps reduce bias by gathering different perspectives to create something collectively.     - Online Tools: The world is becoming more digital, allowing tools to facilitate inclusion of diverse opinions.         - Example: Holding Zoom calls with people from across the globe to gather ideas for an innovation.
  • Definition of Programs     - Programs: Refer to a collection of code statements put together to perform a task.     - Purpose: Programs generally take an input and produce an output, which defines the purpose of the program.     - Inputs: Can include audio, text, visual, and many more. Inputs originate from users or other programs.         - Example: In an Amazon Echo, the input is a human voice, and the program output responds based on that audio input.
  • The Development Process     - Adjustments: Programs undergo processes where they are adjusted, reviewed, and given feedback.     - Investigation Techniques: User testing, reviews, and observations allow programmers to identify program constraints.     - Correction: Programs must be adjusted along the way during development.
  • Program Errors     - Logic Errors: These are simple mistakes in the algorithm causing incorrect behavior. For example, a programmer might accidentally add 1010 instead of 55, resulting in a wrong output.     - Syntax Errors: Mistakes in the programming language. Languages have a set way code must be written; failing to follow these rules results in a syntax error.     - Runtime Errors: These occur during the execution of a program. For example, trying to access an element in an array that is out of bounds. The syntax is correct, but when the program runs, it realizes it cannot execute the request.     - Overflow Errors: These occur when a compiler tries to handle a number outside its defined range of values.
  • Resolving Errors     - Debugging tools and methods include:         - Looking at test cases.         - Running the program.         - Visualizing the code to find the problem.

Big Idea 2: Data Representation and Storage

  • Binary Storage (Bits)     - Bits: Computers store data in bits, which are base 22 numbers represented by ones (11) and zeros (00).     - Bite (Byte): Defined as 88 bits.     - Example: The number 100100 in base 22 represents the value 88 in decimal if formatted as a sequence of bits where only the third power is active.
  • Base Conversion (Decimal to Binary)     - Process: To convert a decimal (base 1010) number to base 22:         - Step 1: Find the highest power of the base (22) that is less than or equal to the target number.         - Step 2: Subtract that value from the number and repeat until the remainder is 00.     - Example Conversion of 1010 from base 1010 to base 22:         - 23=82^3 = 8. This is the highest power of 22 less than 1010. Place a 11 at the 232^3 position.         - 10−8=210 - 8 = 2.         - 21=22^1 = 2. Place a 11 at the 212^1 position.         - Fill the remaining positions (e.g., 222^2 and 202^0) with 00.         - The answer should be the bit sequence representing 1010.
  • Data Abstraction     - Programmer Representation: Programmers use lists, variables, or constants to represent data.     - Computer Conversion: The computer converts high-level representations into bits for internal processing.     - Grouped Bits: Many bits grouped together form abstractions like colors (e.g., RGB).     - Context: The same sequence of bits can mean different things in different contexts. For example, a bit sequence could represent a color in one context and the jump height for a character in a video game in another context.
  • Analog vs. Digital data     - Analog Data: Refers to data that changes smoothly over time, such as pitch or a sprinter's position.     - Digital Data: Used to represent analog data electronically through abstraction.     - Sampling: Sampling techniques measure analog data at different intervals called samples to model the original analog data.
  • Limitations of Numbers     - Fixed Bits: Programming languages have a fixed number of bits to represent integers.     - Roundoff Errors: Occurs when a number is too precise for the language to store (e.g., a decimal with many trailing zeros and a 11 at the end like 0.0000000010.000000001).     - Overflow Errors (Data context): These occur when a value results in too many bits to store, making the value too large.
  • Data Compression     - Definition: Reducing the number of bits of transmitted or stored data to prevent files from being too large.     - Lossless Compression: Reduces bits while guaranteeing a complete restoration to the original size. Use this when a perfect replica is vital.     - Lossy Compression: Reduces bits significantly but only allows an approximate restoration. Data is lost during compression, but the file size is smaller. Use this when the priority is minimizing data size over perfect fidelity.
  • Metadata     - Definition: Metadata is data about the data.     - Example: For an image, metadata includes the time, location, and conditions (e.g., taken 500 feet500\,feet above ground) of when it was taken.     - Independence: Changes to metadata do not affect the actual data (the image itself remains the same even if you change the recorded location from "sky" to "ground").     - Use: Allows for structured and organized information.
  • Data Cleaning and Bias     - Data Cleansing: Vital for ensuring data is complete and easy to analyze. Data sources may not be uniform.     - Uniformity Example: Converting "Cal," "California," and "Cali" to "CA" in a dataset so a program can identify them as the same place.     - Bias Reduction: Achieved through thoughtful collection from diverse sources. Getting data from only one place increases bias.
  • Large Data Sets     - Trade-off: Larger data sets provide more information but take more time to process and may require complex computing systems like Parallel Computing.     - Processing: Programs filter and transform data sets, and can merge different sets to identify correlations and patterns. Note: Correlations do not establish causation; well-defined experiments are needed for causation.

Big Idea 3: Algorithms and Programming

  • Variables and Assignments     - Variable: Something that holds a value to be referred to later. It is best to use creative, descriptive names (e.g., using height_of_clouds instead of just h).     - Type Definition: Some languages like Java require defining variable types; others like Python do not.     - Assignment: The operation of assigning a value to a variable. Every new assignment changes the value. For example, if a=5a = 5 and then a=10a = 10, the value of aa is now 1010.
  • Data Structures     - Lists: Used to represent multiple variables together.     - Indexing: In many languages, the first index is 00, but on the AP exam, we assume the first index is 11.         - Example: In a list where index 1=1,2=3,3=4,4=11,5=151 = 1, 2 = 3, 3 = 4, 4 = 11, 5 = 15, the length is 55.     - Strings: A list of characters. Strings can be concatenated (combined).
  • Mathematical Expressions     - Operations: Addition, Subtraction, Division, Multiplication.     - Mod (Modulo): Gives the remainder of a division. Example: 10 MOD 3=110\text{ MOD }3 = 1.     - Order of Operations: Follows standard mathematical PEMDAS rules.
  • Boolean Expressions     - AND: Both conditions must be true.     - OR: At least one condition must be true.     - NOT: The condition must not be true (reverses the value).
  • Conditionals and Loops     - If-Statements: Control the sequential flow. If the condition is true, the block executes. If there is an "Else" statement, it executes when the "If" condition is false. Conditionals can be nested.     - Loops: Allow repetitive tasks.         - Repeat nn times (For Loop): Straightforward repetition.         - Repeat until XX is True (While Loop): Keeps running while the condition is true and stops when it becomes false. Can run infinitely if the condition never changes.
  • List Operations on AP Exam     - aList[i]: Accesses element at index ii.     - Assignment at Index: aList[i] = x sets the value at index ii to xx.     - Insert: Places a value at a specific index.     - Append: Adds a value to the end of the list.     - Remove: Removes an element at a given index.
  • Searching Algorithms     - Linear Search: Checks every value from the start to the end of a list.     - Binary Search: Used only on sorted lists. It starts at the middle; if the middle value is too high, it discards the top half. This continues until the value is found, making it more efficient than linear search.
  • Procedures and Modularity     - Procedures: Also called methods or functions. A named group of instructions with a purpose.     - Parameters: Input variables.     - Arguments: The specific values passed to the parameters.     - Abstraction: Using a procedure without knowing its internal code simplifies complexity and improves readability.     - Libraries: Collections of built-in procedures.     - APIs (Application Program Interfaces): Documentation specifying how to use procedures in a library.
  • Simulations     - Definition: Abstractions of complex real-world processes.     - Use: Used to test events faster or cheaper than in reality (e.g., weather simulation).     - Randomness: APIs often provide a random(a, b) function to generate a random integer between aa and bb to simulate real-world variability.
  • Algorithmic Efficiency     - Problem Types:         - Decision Problems: Have a Yes/No answer.         - Optimization Problems: Finding the best possible solution.     - Complexity: Measured by computational resources (time or operations) relative to input size nn.     - Reasonable Time: Polynomial efficiency (n2,n3n^2, n^3, etc.) or faster (linear/constant).     - Unreasonable Time: Exponential or factorial efficiencies (2n,n!2^n, n!). As nn grows large, these expand extremely fast.     - Heuristic Algorithms: Shortcuts used when optimal techniques take too long. They provide a "good enough" solution that may not be perfectly accurate.     - Decidable Problems: Can be solved by an algorithm for all possible inputs.     - Undecidable Problems: Cannot be solved by an algorithm for all inputs.

Big Idea 4: Computer Systems and Networks

  • The Internet and Communication     - Computing Devices: Physical artifacts that run programs (computers, tablets, routers).     - Computer Networks: Groups of connected devices capable of sending/receiving data.     - Path: A route of directly connected devices from sender to receiver.     - Routing: The process of finding that path.     - Bandwidth: The maximum amount of data sent in a fixed time, measured in bits per secondbits\,per\,second.
  • Protocols     - Definition: An agreed set of rules specifying the behavior of a system.     - Open Protocols: Standardized and open rules (like IP, TCP, UDP, HTTP) allow the internet to be scalable as new devices are easily added.     - World Wide Web: A system of linked pages and programs that uses the internet and the HTTP protocol.
  • Data Transmission     - Data Streams: Information passed as chunks of data encapsulated in packets.     - Packets: Contain data and metadata. They can arrive out of order or not at all; protocols rearrange them at the destination.
  • Fault Tolerance and Redundancy     - Redundancy: Having multiple paths between devices. If one root fails, data travels another path.     - Reliability: Redundancy increases the reliability and scalability of the internet.
  • Parallel vs. Distributed Computing     - Sequential Computing: Operations are performed one at a time.     - Parallel Computing: Tasks are broken into smaller sequential operations performed simultaneously across multiple processors.         - Calculation: It takes as long as the sequential steps plus the longest parallel step.         - Speedup: Calculated as Sequential TimeParallel Time\frac{\text{Sequential Time}}{\text{Parallel Time}}.     - Distributed Computing: Uses many separate devices to run a program, helping with large processing times or storage needs.     - Efficiency Limit: Parallel computing efficiency is limited by its sequential portion; adding more processors eventually stops providing benefit.

Big Idea 5: Impacts of Computing

  • Beneficial and Harmful Effects     - Advances have increased creativity in fields like medicine, communications, and the Arts.     - Programmers must consider unintended effects of their innovations when shared with many users.
  • The Digital Divide     - Definition: Internet access variation based on socioeconomic, geographic, and demographic characteristics.     - Issues: People in poor countries or specific areas lack easy access, creating a need for equality and equity initiatives.
  • Bias in Computing     - Source: Bias can be built-in or reflect a programmer's inherent bias. Diverse perspectives are necessary to reduce bias at all software development levels.
  • Collaboration Models     - Crowdsourcing: Obtaining input or funding from large numbers of people via the internet.     - Citizen Science: Scientific research conducted by regular individuals using their own devices to contribute data.
  • Legal and Ethical Concerns     - Intellectual Property (IP): Material on a computer is the IP of the creator. Easy access raises concerns about piracy and unauthorized distribution.     - Plagiarism: Using material without permission or credit has legal consequences.     - Licensing:         - Creative Commons: A public copyright license enabling free distribution of work.         - Open Source: Programs made freely available for redistribution or modification.         - Open Access: Online research output free of access restrictions.
  • Safe Computing     - PII (Personally Identifiable Information): Info that identifies an individual (age, race, Social Security number).     - Exploitation: Search engines use history for targeted marketing; cookies create knowledge profiles on individuals.     - Data Persistence: Information put online is difficult to delete.     - Authentication:         - Multiactor Authentication (MFA): Using two-step verification or security questions (e.g., "What is your first dog's name?").         - Strong Passwords: Using uppercase, lowercase, symbols, and numbers.
  • Encryption     - Encryption: Encoding data to prevent unauthorized access.     - Decryption: Decoding the encoded data.     - Symmetric Key Encryption: One key is used for both encryption and decryption.     - Public Key Encryption: Uses a pair of keys—a public key for encryption and a private key for decryption. Metaphor: Like a mailbox where anyone can put mail in, but only the owner has the key to open it.     - Certificate Authorities: Issue digital certificates to validate ownership of encryption keys.
  • Malicious Software and Attacks     - Viruses: Malicious programs that gain unauthorized access and run independently.     - Malware: Software intended to damage a system.     - Fishing (Phishing): Tricking users into revealing personal info to access sensitive accounts.     - Keylogging: Recording every keystroke to steal passwords.     - Rogue Access Point: Intercepts data sent over public networks.

The Create Task

  • Overview     - A classroom coding project with specific requirements.     - Example projects: A Jeopardy game, an adventure story, or Tic Tac Toe.     - Can be created in any programming language.
  • Required Concepts     - Sequencing: The computer runs code top to bottom. This can be broken when calling a procedure.     - Selection: Boolean statements (like If-statements) that determine which code executes.     - Iteration: Repeating code steps using For Loops or While Loops.