AP CSP Big Ideas Exam Notes
Big Idea #1: Creative Development
Collaboration
Collaboration in programming is a creative process where individuals or teams work together to bring ideas to life. Effective collaboration results in a computing innovation (a program) that benefits from the diverse talents and perspectives of its designers. Diverse perspectives in collaboration help avoid bias.
Benefits of Collaboration:
Users provide feedback to incorporate various perspectives.
Diverse backgrounds and perspectives reflect the strengths of individual team members.
Pair Programming:
Two programmers develop software at one computer, acting as driver and navigator, to improve the project or program.
Creative Development - Programming Errors
Types of Programming Errors:
Syntax error
Runtime error
Logic error
Overflow error
Syntax Error
Misspelled commands
Case errors (programming is case-sensitive)
The program won't run at all.
Example:
DISPLAY (A
Runtime Errors
The program starts to run, but it fails when an error prevents it from continuing.
Logic Error
The program runs, but produces unexpected or incorrect results.
Example:
IF (a > 90) DISPLAY ("You got an A.") IF (a > 80) DISPLAY ("You got a B.") IF (a > 70) DISPLAY ("You got a C.")
Overflow Error
Occurs when a command tries to handle a value outside the defined range or limit. The value exceeds the maximum allowed number.
Big Idea #2: Data
Binary Numbers
Numbers represented with base 2 digits (0 and 1 only).
Bit: The smallest unit of information stored or manipulated on a computer.
Byte: A group of 8 bits.
Example: A group of 8 bits has 256 possible combinations.
The maximum value in 8 bits is 255 (256 - 1 = 255).
2^8 = 256
Number Systems: Binary, Decimal, Hexadecimal.
Number Systems
Binary: Powers of 2 (0, 1).
256, 128, 64, 32, 16, 8, 4, 2, 1
Hexadecimal: Powers of 16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F), where A=10, B=11, C=12, D=13, E=14, F=15.
256, 16, 1
Converting 38 (base 10) into Binary and Hexadecimal
Use the powers of 2 to convert to binary and the powers of 16 to convert to hexadecimal.
Data Compression
A reduction in the size (number of bits) of data transmitted or stored.
Packs data into a smaller space while allowing for the original data to be seen again.
Helps when backing up files, especially when uploading over the internet.
Uses an encoding algorithm to create a compressed representation and a decoding algorithm to reconstruct the original message.
Metadata
Data that describes other data.
Needed to classify and categorize data.
Describes relevant information about the overall data.
Examples: author, file size, date created, usage, etc.
Sample Question: Metadata for a Music File
Which of the following are likely metadata collected for a music file?
a. Song Name
b. Size of song
c. Type of file (MP3, AVI, etc…)
d. Time at which the song was recorded
Answer: (d) Time at which the song was recorded
Lossy vs. Lossless Compression
Lossy Compression:
Does NOT restore data to its original form.
A significant reduction in the number of bits stored.
Only approximates the original form, and some data/pixels are removed permanently.
Works best for images, music files, movies.
Lossless Compression:
FULLY RESTORES data to its original form.
Reconstructs the original data exactly as it was from the compressed data.
Takes more time and more storage space.
Works best for texts, messages, files.
Sample Question: Advantage of Lossy Compression
The biggest advantage of lossy compression algorithms over lossless algorithms is that while transmitting data:
a. The loss of data is inconsequential.
b. The packet transfer through the internet is faster.
c. The number of bits stored or transmitted is reduced.
d. The algorithm is designed for efficient transmission.
Answer: (c) The number of bits stored or transmitted is reduced.
Big Idea #3: Algorithms and Programming
Use the reference sheet for pseudocode syntax.
Variable: An abstraction inside a program that stores a value.
Boolean: A True or False value.
Selection (conditionals):
if,elif,else.Iteration (looping):
while,repeat,repeat until.String: A character, symbol, letter, word, or combination of words.
Modulus: (MOD) The remainder left after division.
List: A data type that stores a collection of values (an array of values).
Algorithmic Efficiency: Determining how an algorithm performs.
Sample Question: Algorithm Design
While designing algorithms, it is important to remember:
a. All algorithms are efficient.
b. It is possible to calculate the amount of memory an algorithm will use.
c. There is more than one algorithmic solution to a problem.
d. All algorithms have to be expressed in a specific format.
Answer: (c) There is more than one algorithmic solution to a problem.
Big Idea #4: Computing Systems and Networks
The internet is an example of a massive computer network.
Computing Device: A physical artifact that can run a program (computer, smartphone, tablet, server, router).
Computing System: A group of computing devices and programs working together for a common purpose.
Computer Network: A group of interconnected computing devices that send and receive data.
Routing: The process of finding a path from a sender to a receiver.
Bandwidth: The maximum amount of data that can be sent in a fixed amount of time (measured in bits per second).
Packet: A small amount of data sent over a network.
Fault Tolerance: The ability of a network to find a different path between a sender and a receiver.
Cyberattacks: Malicious attacks that could cause a network to crash.
Protocol: An agreed upon set of rules that specify the behavior of a system. Common protocols are IP, OSI, TCP, UDP.
Parallel Computing: Breaking a program into smaller, sequential operations using multiple processors. It helps save time, reduces heat, and saves time and money.
Distributed Computing: A model in which multiple devices run a program. Solves more difficult problems.
Sample Question: Internet Reliability
One significant feature of the Internet that makes it reliable is:
a. Protocols
b. Routing
c. Redundancy
d. Scalability
Answer: (c) Redundancy (more than one way to send data)
Sample Question: Critical Design Aspect of the Internet
Which of the following is NOT a critical design aspect of the Internet?
a. Redundancy
b. Scalability
c. Fault Tolerance Design
d. Design of the World Wide Web
Answer: (d) Design of the World Wide Web (WWW is not the same as the internet!)
Big Idea #5: Impact of Computing
Not every effect of a computing innovation is anticipated in advance.
A single effect can be viewed as both beneficial and harmful by different people.
Computing can play a role in social and political issues which raises legal and ethical concerns, such as digital media, streaming, social media, collecting and analyzing data, and monitoring activities.
The Digital Divide: The disparity between those who have access to technology and those who do not.
Computing innovations and algorithms can reflect human biases.
Crowdsourcing: The practice of obtaining input or information from a large number of people via the Internet.
Encryption: The process of encoding data to prevent unauthorized access.
Decryption: The process of decoding the data.
Phishing: A technique that attempts to trick a user into providing personal information (can be used to access bank accounts, emails, etc.).
Malware: Software intended to damage a computing system or to take partial control over its operation.
Sample Question: Information About A Person
Information about a person, such as name, age, email id is called:
a. Personalized data
b. Metadata
c. Cookie data
d. Personally Identifiable Information
Answer: (d) Personally identifiable information
Questions
The AP Test Loves to Ask
Swap Values
To swap values, use a temporary variable:
temp ← x
x ← y
y ← temp
This is the correct approach to swap variables using a temporary variable.
Bits!
Every bit is represented by a power of 2.
Question 1
What is the minimum number of bits you would need to represent a number on a 0 to 10 scale?
a. 1 bit
b. 2 bits
c. 3 bits
d. 4 bits
1 bit = 2^1 → 2 (not enough)
2 bits = 2^2 → 4 (not enough)
3 bits = 2^3 → 8 (not enough but close!)
4 bits = 2^4 → 16 YES! 16 is enough numbers to represent 0-10
Answer: d. 4 bits
Question 2
How many possible items can be numbered using 9 bits?
a. 18
b. 81
c. 511
d. 512
2^9 = 512
Answer: d. 512
Question 3
A company with 850 employees provides a computer and a mobile phone to each person. What is the minimum number of bits in binary to provide unique internet addresses for each device?
a. 9
b. 10
c. 11
d. 12
9 = 2^9 → 512 (not enough)
10 = 2^{10} → 1024 (not enough)
11 = 2^{11} → 2048 (YES! enough)
12 = 2^{12} → 4096 (not the minimum)
Careful! If 850 people have a phone and computer that’s 850 + 850 or 1700 possible addresses.
Answer: c. 11
Bytes!
Every 8 bits makes up 1 byte.
Question 1
What is the minimum number of bytes that are required to represent the number 2719 in binary?
a. 1 byte
b. 2 bytes
c. 3 bytes
d. 4 bytes
Robot Questions!
Use pseudocode to answer questions. Get the robot to the gray square. Determine the code segment. End at the gray square, avoiding the black squares.
Math & Modulus Questions!
Don't forget to use PEMDAS. MOD is the remainder after you divide.
Question 1
What would be the output from the following code segment?
a ← 22
b ← 5
c ← a MOD b
DISPLAY (c)
c = 22 MOD 5 = 2
Question 2
A rectangular garden of (11011110100)2 foot length and (10101111000)2 foot wide is being fenced in. The cost of the fence is $5 per foot. Which of the following expresses the total cost of fencing the garden?
a. $15,300
b. $20,100
c. $25,100
d. $31,800
Heuristic Approach
Finds approximate solutions to a problem and guides an algorithm to find good choices.
Question 1
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
a. When the problem can be solved in a reasonable time and an approximate solution is acceptable
b. When the problem can be solved in a reasonable time and an exact solution is needed
c. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
d. When the problem cannot be solved in a reasonable time and an exact solution is needed
Use a heuristic approach when a problem CANNOT be solved in a reasonable time, and an approximate solution is acceptable.