AP Computer Science Principles Notes

AP Computer Science Principles Course Study Guide

Main Ideas

  • AP Computer Science Principles (CSP) teaches computational thinking and concepts central to computer science.
  • It is organized around five ideas studied throughout the course:
    • Creativity
    • Abstraction
    • Data/Information
    • Algorithms
    • Programming
    • The Internet
    • Global Impact
  • These ideas build a base for prospective computer science courses.

Creativity:

  • Creativity is an important part of innovation.

Abstractions:

  • Abstractions minimize extra details to focus on pertinent information, helping manage complexity.

Data/Information:

  • Data and information are the input for computing.
  • Computation translates raw data into consumable information.

Algorithms:

  • Algorithms develop solutions to computational problems.

Programming:

  • Programming and the creation of software enable problem-solving and are directly related to creating algorithms.

The Internet:

  • The internet has a heavy effect on society.
  • It is important to understand how it is built and functions when analyzing concerns such as cybersecurity.

Global Impact:

  • Computation has changed the way we communicate and problem-solve.

Unit 1: The Internet Vocab

  • The Internet: A group of computers and servers that are connected.
  • Prototype: An original model on which later versions are patterned.
  • Innovation: Something new, a change; the act of introducing a new method, idea, device, etc.
  • Binary: A way of representing information using only two options.
  • Bit: A contraction of "Binary Digit"; the single unit of information in a computer, typically represented as a 0 or 1.
  • Bandwidth: Transmission capacity measured by the bit rate.
  • Bit rate: The number of bits that are conveyed or processed per unit of time (e.g., 8 bits/sec).
  • Latency: Time it takes for a bit to travel from its sender to its receiver.
  • Protocol: A set of rules governing the exchange or transmission of data between devices.
  • Abstraction: A simplified representation of something more complex.
  • ASCII (American Standard Code for Information Interchange): The universally recognized raw text format that any computer can understand.
  • IP Address: A number assigned to any item connected to the Internet.
  • Packets: Small chunks of information carefully formed from larger chunks of information.
  • Network Redundancy: Having multiple backups to ensure reliability during cases of high usage or failure.
  • Router: A type of computer that forwards data across a network.
  • DNS (Domain Name System): Translates domain names (like example.com) to IP addresses (like 93.184.216.34).
  • IETF (Internet Engineering Task Force): Develops and promotes voluntary Internet standards and protocols, especially the standards that comprise the Internet protocol suite (TCP/IP).
  • Request for Comments: How standards and protocols are defined and published for all to see on the IETF website.
  • HTTP (HyperText Transfer Protocol): The protocol used for transmitting web pages over the Internet.
  • TCP (Transmission Control Protocol): Provides reliable, ordered, and error-checked delivery of a stream of packets on the internet. Usually seen as TCP/IP in writing.
  • URL (Uniform Resource Locator): An easy-to-remember address for calling a web page (like www.code.org).
  • SSL (Secure Sockets Layer): Standard security technology for establishing an encrypted link between a web server and a browser.
  • SSL Certificate: A web server requires an SSL certificate, obtained from a Certification Authority (CA), to create an SSL certificate.
  • TLS (Transport Layer Security): A cryptographic protocol that provides end-to-end communication security over networks, widely used for internet connections and online transactions; an IETF standard to prevent tampering and message forgery and the successor to SSL.
  • SMTP (Simple Mail Transfer Protocol): High-level protocol for formatting and sending email messages between mail servers.
  • POP (Post Office Protocol): and IMAP (Internet Message Access Protocol) are used to retrieve emails on the server's side.
  • HTML (Hypertext Markup Language): A computer code used to tell a web page how to look.
  • Net Neutrality: The principle that all Internet traffic should be treated equally by Internet Service Providers.

Sending Information

  • The internet works like a postal service that ships binary information.
  • Binary information is made of bits - any pair of opposites (like on or off, or yes or no).
  • Bits are sent in three ways:
    • Light
    • Electricity
    • Wirelessly
  • Copper wire:
    • Pros: Cheap
    • Cons: Signal loss
  • Fiber optic cable:
    • Pros: Fast, no signal loss
    • Cons: Expensive, hard to work with
  • Radio waves:
    • Pros: Mobile
    • Cons: Short range
  • Bits are usually represented as either a 1 or a 0.
  • This system of numbers is called binary or base2 (since there are 2 bases).

Reading Binary

  • Binary is a system of counting that has 2 bases, unlike the decimal system that has 10 bases.

  • Binary is an on or off system, meaning a bit is either on or off.

  • Binary is calculated from left to right, and each digit is 2^n (where n is the number of spaces to the left).

  • Example 1: 0101 1001

    1. Number digits from right(0) to left:
      7654 3210

    2. Each digit is 2 to the power above:
      2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

    3. Disregard digits with a 0 2^6 2^4 2^3 2^0

    4. Add the numbers together: (64+16+8+1) = 89

  • Example 2: 10 1110

    1. Number digits from right(0) to left: (54 3210)
    2. Each digit is 2 to the power above: (2524 23222120)
    3. Disregard digits with a 0 since they are “off” (2523 2221)
    4. Add all the numbers together (32+8+4+1) = 46
  • ASCII (American Standard Code for Information Interchange) is written using binary, with 8 bits or a byte representing an ASCII character.

How Does Information Travel

  1. All information to be sent over the internet is cut into smaller packets that are numbered to keep the order of the information.
  2. Information is sent over the internet in these smaller packages.
    • Information used to reconstruct the file is on the outside of the packages:
      • Sender
      • Receiver
      • Source file
      • Packet Number
    • Packets travel on their own through different routers trying to find the fastest path.
      • Having extra routers for this purpose is called network redundancy, which makes the system more fault-tolerant.
  3. TCP/IP processes the packet by extracting and merging its inside data with the data from the other packets from the same file, in the correct order, to rebuild the file from its packets.
    • If there is missing/incorrect data, TCP/IP from this computer will send a message to TCP/IP on the sender computer, asking to resend a particular packet.

Unit 2: Digital Information Vocab

  • Heuristic: A problem-solving approach (algorithm) to find a satisfactory solution where finding an optimal or exact solution is impractical or impossible.
  • Lossless Compression: A data compression algorithm that allows the original data to be perfectly reconstructed from the compressed data.
  • Lossy Compression: Irreversible compression; a data compression method that uses inexact approximations, discarding some data to represent the content. Most commonly seen in image formats like .jpg.
  • Image: A type of data used for graphics or pictures.
  • Metadata: Data that describes other data (e.g., a digital image may include metadata that describes the size of the image, number of colors, or resolution).
  • Pixel: Short for