AP CSP Big Ideas Notes

Big Idea #1: Creative Development

  • Collaboration: A creative process in programming where individuals or teams work together to bring ideas to life.
    • Effective collaboration results in a computing innovation (a type of program) that showcases the diverse talents and perspectives of its designers.
    • Collaboration with diverse perspectives helps to avoid bias.
    • It's important to get multiple perspectives.
  • Benefits of collaboration:
    • Users can provide feedback to incorporate different perspectives into the software.
    • Including diverse backgrounds and perspectives can highlight the strengths of individual team members.
  • Pair Programming: A method where two programmers work together on one computer, with one acting as the driver and the other as the navigator, to improve the project or program.

Programming Errors

  • Different types of programming errors:
    • Syntax error
    • Runtime error
    • Logic error
    • Overflow error

Syntax Error

  • Occurs due to misspelled commands or case errors (since programming is case-sensitive).
  • The program will not run at all.
    • Example: DISPLAY (A)

Runtime Errors

  • The program starts running but fails when it encounters an error that 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.")

Overflow Error

  • Occurs when a command tries to handle a value outside of the defined range or limit; the value exceeds the maximum allowed.

Big Idea #2: Data

  • Binary Numbers: Numbers represented using 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 (since 256 - 1 = 255).
      • 2^8 = 256
    • Number systems: Binary, Decimal, and Hexadecimal.

Binary

  • Powers of 2 (0, 1)
  • Reference:
    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)
  • Reference:
    256 16 1

Sample Question: Convert 38 in base 10 into Binary and Hexadecimal

  • Use powers of 2 to convert to binary and 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 recovered.
    • Helpful for backing up files, especially when uploading online.
    • 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: 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.
  • Significant reduction in the number of bits stored.
  • Only approximates the original form; some data/pixels are permanently removed.
  • Works best for images, music files, and 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, and files.

Sample Question: 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

  • Reference the Pseudocode Syntax Sheet.
  • 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: 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.
    • Helps save time, reduces heat, saves time and money.
  • Distributed Computing: A model in which multiple devices run a program.
    • Solves more difficult problems.

Sample Question: 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: 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, raising legal and ethical concerns
    • Digital media, streaming, and 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, potentially accessing 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, 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

  • Correct Method
    temp ← x x ← y y ← temp

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 = 2^1 → 2 (not enough)
  • b. 2 bits = 2^2 → 4 (not enough)
  • c. 3 bits = 2^3 → 8 (not enough but close!)
  • d. 4 bits = 2^4 → 16 YES! 16 is enough numbers to represent 0-10

Question 2: How many possible items can be numbered using 9 bits?

  • a. 18
  • b. 81
  • c. 511
  • d. 512
  • 2^9 = 512
  • ALWAYS RAISE 2 TO THE POWER OF # OF BITS GIVEN

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 = 2^9 → 512 (not enough)
  • b. 10 = 2^{10} → 1024 (not enough)
  • c. 11 = 2^{11} → 2048 (YES! enough)
  • d. 12 = 2^{12} → 4096 (not the minimum)
  • CAREFUL! If 850 people have a phone and computer that’s 850 + 850 or 1700 possible addresses

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: What would be the output from the following code segment?

 a ← 22
 b ← 5
 c ← a MOD b
 DISPLAY (c)

Garden Fencing Question

  • 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/guides an algorithm to find good choices.

Question: 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.