Ap CSP Guide
Ap CSP Guide
COMPUTER
SCIENCE
PRINCIPLES
COURSE STUDY GUIDE
BY: SIMPLE STUDIES
note: this guide was designed to align with the 2019 CED
Intro to AP CSP
AP computer science principles (CSP) is a course that teaches the computational thinking
conventions and the concepts which are central to computer science. It is organized around five
ideas that are studied throughout the entire course. These ideas help build a base for prospective
Main ideas
● Creativity: creativity is an important part of innovation.
● Abstractions: abstractions minimize extra details so that you can focus on the pertinent
information. It helps manage complexity.
● Data/Information: Data and information are the input for computing and we use
computation to translate raw data into consumable information
● Algorithms: algorithms are used to develop solutions to computational problems
● Programming: programming and the creation of software enables problem-solving and is
directly related to creating algorithms
● The Internet: The internet has a heavy effect on society and it is important to understand
how it is built and functions. This is important when analyzing concerns
such as cybersecurity
● Global Impact: computation has changed the way in which we communicate and problem
solve.
Unit 1: The Internet
Vocab
**Definitions are provided by college board we do not claim ownership of the vocabulary definitions in this course
- 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.
- IETF (Internet Engineering Task Force)- develops and promotes voluntary Internet
standards and protocols, in particular 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. TCP is tightly linked with IP and usually
successor to SSL.
- SMTP (Simple Mail Transfer Protocol) - high-level protocol for formatting and sending
email messages between mail servers.
- POP (Post Office Protocol)- 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 a lot 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, and wirelessly
■ Copper wire is used to send information electronically
Pros- cheap Cons- signal loss
■ Fiber optic cable is used to send information using light
Pros- Fast, no signal loss Cons- expensive, hard to work with
■ Radio waves are used to send wireless
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 is used
commonly that has 10 bases
○ Binary is an on or off system which means that a bit is either on or off
● Binary is calculated from left to right and each digit is 2 to the power of n (the number of
spaces to the left)
https://bournetocode.com/projects/GCSE_Computing_Fundamentals/pages/3-3-5-ascii.html
3. TCP/IP process the packet by extracting and merging it’s inside data with the data from
the other packets from the same file, in the correct order, in 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
Vocab
**Definitions are provided by college board we do not claim ownership of the vocabulary definitions in this course
- 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.
○ 7F
1. Starting with 0, number all the digits from left to right (10)
2. Each digit is 2 to the power above (7x161Fx160 )
3. Disregard all digits with a 0 since they are “off”; note that A-F correspond to
10-15 respectively (7x16115x160 )
4. Add all the numbers together (112+15)
5. The answer is 127
○ As you can see in the image, CMYK is a subtractive color scheme that uses the
colors to tint the light which makes the colors darker as you mix them. All the
colors mixed added to a constant (k) makes black
○ RBG is an additive color scheme that uses colored light (which is why it's
commonly used in screens) so that the colors get lighter as you mix them. All the
colors added together to make white
Units
Bit
Nybble 4 bits
Byte 8 bits
Vocab
**Definitions are provided by college board we do not claim ownership of the vocabulary definitions in this course
and features designed to make common tasks easier to program. Any high-level
functionality is encapsulated as combinations of low-level commands
- Selection- a generic term for a type of programming statement (usually an if-statement)
that uses a Boolean condition to determine, or select, whether or not to run a certain
block of statements
- Sequencing- putting commands in the correct order so computers can read the
commands
- Function- a named group of programming instructions
- Parameter- an extra piece of information that you pass to the function to customize it for
a specific need
- For Loop- a particular kind of looping construct provided in many languages. Typically,
defines a counting variable that is checked and incremented on each iteration to loop a
specific number of times
- Loop- a programming construct that repeats a group of commands
- Blocks- pieces of code that you use to solve a problem; in App Lab, they can be dragged
from the toolbox menu to the workspace to create a program
- Subgoal- parts of a problem's solution (the overall goal); used so you can focus on
figuring out which block(s) you need to solve each subgoal rather than trying to solve the
whole problem at once
- Efficiency- achieving some desired outcome while minimizing wasted effort or
resources
- Abstraction- a simplified representation of something more complex
Programming languages
● When you formalize language or commands that describe actions you are making a kind
of code.
● Computers are simply machines that can perform many different tasks.
○ In order, to write instructions for them to do something you must agree on the
“code”
○ Each action must have a precise, unambiguous meaning
● This is the basis of a programming language
○ You might think that a programming language looks like an archaic mass of
abstract words, but all programming languages are derived from the need to
concisely give instructions to a machine
● To design an algorithm:
○ Step1: Discover common instructions
■ This includes turning right, saving a number by changing a variable,
jumping to a certain line in the instructions, etc.
○ Step 2: Agree on a minimal instruction set
■ Recognizing these commonalities can give you names to a few commands
and agree about how they should be interpreted.
Variables
● When you are
programming, variables are
used to hold information
○ They essentially work like containers where you can change their value when you
need to hold another number
○ Variables may look like simple math but it is not
○ Ex. x = 2
x=5
x=x+1
■ At first sight, the equation might not make sense, but x is a variable (so
remember it is like a container)
■ “=” is the assignment operator, so‘x=2’ means that you are assigning x the
value of 2
■ The value of x is now 6 because x is assigned the value of 5 + 1 which is 6
Vocab
**Definitions are provided by college board we do not claim ownership of the vocabulary definitions in this course
- Big Data- a broad term for datasets so large or complex that traditional data processing
applications are inadequate
- Moore's Law- a prediction made by Gordon Moore in 1965 that computing power will
double every 1.5-2 years, it has remained more or less true ever since.
- Caesar cipher- a technique for encryption that shifts the alphabet by some number of
characters
- Cipher- the generic term for a technique (or algorithm) that performs encryption
- Cracking encryption- When you attempt to decode a secret message without knowing
all the specifics of the cipher, you are trying to "crack" the encryption.
- Decryption- a process that reverses encryption, taking a secret message and reproducing
the original plain text
- Encryption- a process of encoding messages to keep them secret, so only "authorized"
parties can read it.
- Random substitution cipher- an encryption technique that maps each letter of the
alphabet to a randomly chosen other letters of the alphabet.
- Computationally Hard- a "hard' problem for a computer is one in which it cannot arrive
at a solution in a reasonable amount of time.
- Asymmetric Encryption- used in public-key encryption, it is a scheme in which the key
to encrypt data is different from the key to decrypt.
- Modulo- a mathematical operation that returns the remainder after integer division.
- Private key- In an asymmetric encryption scheme the decryption key is kept private and
never shared, so only the intended recipient has the ability to decrypt a message that has
been encrypted with a public key.
- Public key encryption- Used prevalently on the web, it allows for secure messages to be
sent between parties without having to agree on, or share, a secret key. It uses an
asymmetric encryption scheme in which the encryption key is made public, but the
decryption key is kept private.
- Antivirus software- usually keeps big lists of known viruses and scans your computer
looking for the virus programs in order to get rid of them.
- DDoS attack- Distributed Denial of Service Attack. Typically a virus installed on many
computers (thousands) activates at the same time and floods a target with traffic to the
point the server becomes overwhelmed.
- Firewall- software that runs on servers (often routers) that only allows traffic through
according to some set of security rules.
- Phishing scam- a thief trying to trick you into sending them sensitive information.
Typically these include emails about system updates asking you to send your username
and password, social security number, or other things.
- SSL/TLS- Secure Sockets Layer / Transport Layer Security - An encryption layer of
HTTP that uses public-key cryptography to establish a secure connection.
- Virus- a program that runs on a computer to do something the owner of the computer
does not intend.
- Digital divide- the gulf between those who have ready access to computers and the
Internet, and those who do not.
- Worm- a standalone malware computer program that replicates itself in order to spread
to other computers. It uses a computer network to spread itself, relying on security
failures on the target computer to access it.
- Vignere Cipher- a method of encrypting text by applying a series of Caesar ciphers
based on the letters of a keyword.
- Malware- software that is intended to damage or disable computers and computer
systems.
Ciphers
● Caesar cipher- shifts the alphabet by a certain number to obtain a new alphabet
○ Ex. cipher => elrjgt (shifted by 2)
● Vignere cipher- uses a series of Caesar ciphers based on a code word
○ Ex. cipher => eqeoii (keyword- cipher)
This chart shows how the caesar
ciphers are plotted in the vigenere
cipher and the plain text letter is
chosen by the key letter which is
repeated as many times as needed
● Random substitution cipher- plots each letter of the alphabet to another random letter
○ Ex. cipher => hednyuo
Encryption
● Asymmetric encryption is when the key to encrypt a message is different from the private
key used to decrypt the message.
Hacking
● Some of the most common hacking attacks include DNS spoofing, DDoS attacks,
○ DNS spoofing: when the Domain Name System is hacked to redirect online
■ Ex. the attacker spoofs a DNS record to redirect all the traffic that relied
on the correct DNS record to visit a fake website that the attacker has
created to resemble the real site or a different site completely.
computers activates at the same time and floods a target with traffic. DDoS is one
of the oldest forms of cyber extortion attack
■ Ex. A virus causes thousands of computers to send so much internet
traffic to a server to the point that legitimate users can't join
○ Phishing attack: a thief trying to trick you into sending them sensitive
information.
■ Ex. You get an email from someone who is claiming to be your great aunt
twice removed and wants to give you a million dollars. She asks for your
bank account information so that she can transfer the money
- Event handling- an overarching term for the coding tasks involved in making a program
- Event listener- a command that can be set up to trigger a function when a particular type
of event occurs on a particular UI element
- UI elements- on-screen objects, like buttons, images, text boxes, pull down menus,
screens and so on
- User Interface (UI)- The visual elements of a program through which a user controls or
communicates with the application
- Debugging- Finding and fixing problems in an algorithm or program
- Data type- All values in a programming language have a "type" - such as a Number,
Boolean, or String - that dictates how the computer will interpret it.
- Ex. 7+5 is interpreted differently from "7"+"5"
- Equality operator- Is used for comparing two values, and returns a Boolean (true/false).
Avoid confusion with the assignment operator "="; sometimes read "equal equal" (==)
- Global variable- A variable whose scope is "global" to the program, it can be used and
updated by any part of the code. Its global scope is typically derived from the variable
being declared (created) outside of any function, object, or method
- If-statement- The common programming structure that implements "conditional
statements"
- Local variable- A variable that can only be seen, used and updated by code within the
same scope. Typically this means the variable was declared (created) inside a function;
includes function parameter variables.
- Variable scope- dictates what portions of the code can "see" or use a variable, typically
derived from where the variable was first created. (Global v. Local)
- Concatenate- to link together or join. Typically used when joining together text Strings
in programming
- Ex. "Hello, "+name
that uses a Boolean condition to determine, or select, whether or not to run a certain
block of statements.
6. Scroll down to see other properties for a UI element that might be "hiding" down below.
Data Types
Global vs Local