AP Computer Science Principles Cheatsheet 2024

Computing Innovation

  • Definition: Innovation using a program as a key function.
  • Examples:
    • Physical: Robots, tablets, smart tech.
    • Non-physical: Social media, video games.

Collaboration

  • Benefits: Diverse ideas catering to different people.
  • Pair Programming: Two people sharing one computer and taking turns coding.

Program Function and Purpose

  • Purpose: What a program is designed to do (e.g., solving problems, creative expression).
  • Code Segments: Smaller collections of statements within a program.
  • Code Statements: Individual instructions.
  • Program Inputs: Data a computer takes in and processes (visual, auditory, touch, etc.).
  • Program Outputs: Data the computer returns (same types as inputs).
  • Program Events: Actions that give a program data to respond to.
  • Program Behavior: How a program responds to user interaction.

Development Processes

  • Iterative Development: Developing working prototypes and redeveloping the program through cycles.
  • Incremental Development: Breaking a problem into small parts and reassembling the solution when each part is fixed.
  • Program Documentation: Description of how something in the program works.
  • Comments: Program documentation written directly into the program itself.

Common Errors

  • Logic Errors: Unexpected behavior in program’s output.
  • Syntax Errors: Code does not work properly due to incorrect typing or writing.
  • Run-Time Errors: Error occurs while the code runs.
  • Overflow Errors: Numbers are too big for the computer.

Methods of Fixing Errors

  • Hand Tracing: Manually tracking variables' values as the program goes along.
  • Print Statements: Printing out values to ensure they’re correct.

Data

  • Definition: A collection of facts.
  • Storage: Computing devices store data in bits (binary digits).
  • Machine Code: Computers read machine code, usually in binary.
  • Abstraction: Reduces complexity by focusing on the most important parts and hiding irrelevant parts from the user.

Binary Numbers

  • 8 bits = 1 byte
  • Hexadecimal: Used for RGB color codes; uses Base 16.

Data Representation

  • ASCII code: Converts text to binary format.
  • Analog Data: Measured continuously and changes smoothly.
  • Digital Data: Measured digitally, simplifying data collected (form of abstraction).

Data Compression

  • Dependent on the method used and the amount of repeated info in the data.
  • Lossless Compression: Less compression and better file quality.
  • Lossy Compression: More compression and worse file quality.

Extracting Information from Data

  • Metadata: Data about data.
  • Data Mining: Examining very large data sets to find information.
  • Transforming Data: Editing or modifying data (e.g., doubling every number, graphing data points).
  • Cleaning Data: Making data uniform without changing meaning (e.g., correcting misspelled words).

Pseudocode

  • Important for the MCQ section of the AP Exam.
  • AP Pseudocode has an index that starts at 1.

Data Types

  • Examples: Numbers, strings, lists, and booleans.
  • Strings: Ordered list of characters (“hello world”).
  • Substrings: Part of a string (“ello”).
  • String Concatenation: Connecting two or more strings with a “+”.
  • List (Array): Ordered sequence of elements.
  • Element: Individual value in a list.
  • Index: Number representing the position in the list (e.g., in the list [5,6,7], 5 is at index number 1).
  • Booleans: Either True or False; used with logical operators (NOT, AND, OR).

Mathematical Operators

  • Refer to the exam reference sheet for the meaning of operators such as / and %.
  • MOD (%) gives the remainder of 2 numbers.

Algorithms

  • Definition: Instructions that accomplish a task or solve a problem; created using sequencing, selection, and iteration.

Sequencing, Selection, and Iteration

  • Sequencing: Code executed in the order it is written.
  • Selection: If statements with conditions that need to be met for the selection to run.
  • Else Statements: Attached to if statements, specifying what happens if a condition is not met.
  • Nested Conditional Statements: Conditional statements inside of conditional statements.
  • Iteration: “repeat n times”/”repeat until”; using NOT, AND, and OR to write loops.
  • Binary Search: Algorithm used to search; works by splitting the data set and eliminates ½ the data with each round of splitting.

Procedures/Functions

  • Definition: Programming instructions also called methods or functions.
  • Parameters: Input variables of a procedure.
  • Arguments: A procedure call with defined values.
  • Abstraction: Calling a procedure without knowing how it works.

The Internet

  • Definition: Interconnection of networks.
  • Computer Network: Multiple computing devices (e.g., computer, tablet) communicating with each other.
  • Data Packets: Data on the internet is split into data packets with metadata attached to each packet to tell the routers information.
  • Routing: The process of finding the best path to deliver information.
  • Path: Sequences of connected computing devices (routers) that begin at the sender and end at the receiver.
  • Bandwidth: The rate of data transfer from one device to another; megabits per second.
  • Protocol: Set of rules; the internet uses the TCP/IP and UDP protocols to communicate.
  • World Wide Web: A system of web-pages, programs, and files; runs on the Internet but is not the internet.
  • Scalability: The capacity to change in size and scale to meet new demands.

Fault Tolerance

  • Fault Tolerant: Something can still function even with a partial malfunction.
  • Redundancy: Duplication of things; helps make the internet fault tolerant.

Parallel and Distributed Computing

  • Sequential Computing: Traditional programming where each program is processed at a time.
  • Parallel Computing: Program broken into smaller operations and processed at the same time using multiple processors.
  • Distributed Computing: Multiple devices communicate together to run a program.
  • Sequential Solution: Takes as long as the # of all steps in a program;
    • With 3 steps of a, b, and c length, the sequential solution equals a + b + c
  • Parallel Computing Solution: Faster with less # of cores; if all steps are independent, find the solution that results in the minimum possible time.
  • Speedup of a Parallel Solution: \frac{Sequential Solution Time}{Parallel Solution Time}

Key Concepts

  • Digital Divide: Gaps between those who have access to the internet and those who do not.
    • Affected by demographics, socioeconomic status, and geographic location.
  • Computing Bias: Computing innovations can reflect existing racial/gender/etc biases.
    • Often because computers run on historical data, which reflects historical biases.
  • Intellectual Property: The work that people consider “theirs”.
  • Copyright: The person who created something determines who uses their creation.
  • Creative Commons: Copyright license for creators to give others the ability to use their work.
  • Open-Sourcing: Work is freely shared, distributed, and modified.
  • Open Access: Research available to the public without restrictions.
  • Crowdsourcing: Getting a large amount of input or information from people on the Internet.
  • Citizen Science: Scientific research that the general population helps to conduct.

Digital Security

  • Personally Identifiable Information (PII): Information that can be used to identify you.
  • Virus vs Worm: Viruses are attached to infected files and must be activated by the user; worms can operate independently.
  • Malware: Malicious software that takes control of a system.
  • Phishing: Tricks people into giving their personal information away by pretending to be a trustworthy group.
  • Multi-Factor Authentication: Requiring multiple methods of verification.

Encryption

  • Definition: Encoding data to prevent others from accessing it.
  • Key: A secret piece of information used to encrypt data.
  • Symmetric Key Encryption: One key for both encrypting & decrypting.
  • Public Key Encryption: Public key to encrypt & private key to decrypt.

MCQs Exam Tips

  • 120 minutes (2 hrs) | 70 multiple choice questions | 70% of AP Exam Score
    • Pace yourself! You have around 1.7 minutes for each question so make sure to keep track of the time.
    • If you are confused on a question, skip and come back later. If you cannot understand a question within 5-10 seconds of reading it, try to answer other questions first.
    • If necessary, guess. College Board does not have a guessing penalty (points are only rewarded if earned, not taken away if answered incorrectly.
    • Read the AP CSP reference sheet ahead of time for easy use on the AP Exam.
    • Find and use practice questions! Practice makes perfect!

Performance Task Exam Tips

  • 9 hours in class work time | 30% of AP Exam Score
    • Work ahead of time! Try to avoid submitting your Create Task late to avoid technical errors.
    • Before submitting, review the scoring guidelines on the College Board website to make sure you have fulfilled the requirements for each row on the rubric.
    • To make sure your Create Task is completed properly, view the sample responses on the College Board
      Website and cross reference and compare your work to the samples.
    • Any examples or samples you see, write down to make sure you do not accidentally plagiarize. A Create Task that is flagged for plagiarism will receive a score of 0.
    • Be confident in your work! You have gone through this class for an entire year & are prepared!