AP CSP Topic 1.2 Guided Notes - Program Function and Purpose

Big Idea 1: Creative Development · Topic 1.2 · Guided Notes (Student)

Program Function and Purpose — Guided Notes

Fill these in during class or catch up here if you were absent. Print this page or work on paper — then check yourself with the CFUs on the Topic 1.2 page.

Print these notesTopic 1.2 lesson pageAll CSP topics

Day 1: What Does This Thing Actually Do?

Today’s objectives

  • Describe the purpose of a computing innovation — solving a problem or pursuing interests through creative expression (LO CRD-2.A)
  • Explain how a program or code segment functions, describing it broadly by WHAT it does or in detail by what it does AND how its statements accomplish it (LO CRD-2.B)

Bell ringer

A mystery app is running, and all you can see is its behavior table: you type 50 → it says "Too high." You type 25 → "Too low." You type 37 → "Correct — you got it in 3 tries!" You type banana → "Whole numbers only, please."

Write TWO descriptions of this app: (1) ONE sentence saying what it does. (2) A numbered list of steps for HOW it might do it — what it checks, what it remembers, what it says back.

01. The Purpose of Computing Innovations

Key Vocabulary (LO CRD-2.A & CRD-2.B)

Term Definition (write it)
Computing innovation
Purpose
Program (software)
Code segment
Program behavior

Two Purposes — and Why Developers Care

  • The CED names exactly two purposes for computing innovations: .
  • Understanding an innovation's purpose gives developers .
  • Purpose is the WHY an innovation exists; function is .

Solve a Problem vs. Creative Expression

Solving a problem

Creative expression

  • An innovation built to fix something broken, slow, or unfair serves the purpose.
  • Asked for a purpose on the exam, answer with WHY it exists — never .

AP TIP: If a free-response asks for an innovation's purpose, answer with WHY it exists (problem or expression) — not a list of its features.

Stop and think

  1. A city releases an app that reports potholes to the repair department. In one sentence, state its purpose using the CED's language.
  2. A student codes an animation of falling cherry blossoms 'just because it's beautiful.' Which purpose is this — and why is 'that's not a real purpose' wrong?
  3. A team is redesigning a food-delivery app. Explain what the team gains by first agreeing on the app's purpose.

Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 1.2 page.

02. Programs, Code Segments, and Behavior

One Input Is Never Enough

  • A program needs to work for — not just the one input you tested.
  • The broad level of description says WHAT a program does; the detailed level adds .
  • A program's behavior is how it functions during execution, often described by .

Program, Code Segment, or Behavior?

Same weather app, four artifacts. Classify each one using today's vocabulary.

Complete the empty cells.

Artifact from the weather app Why it fits Classification
The complete installed weather app, everything that runs when you open it A full collection of statements performing a specific task when run — also called software
The five lines inside it that convert Celsius to Fahrenheit A collection of statements that is only PART of the program
"When the user taps refresh, tomorrow's forecast appears in about a second" How the program functions during execution, told through user interaction
"It shows the forecast" vs. "It requests data from a weather service, picks tomorrow's entry, and displays it" The same function told broadly, then in detail with how the statements do it

Watch out — “It Worked Once, So It Works”

Myth: If a program runs correctly on the input you tried, it works — testing one input proves the program is finished.

Explain why this is wrong:

Deep Dive · Beyond the AP Exam

Deep Dive: How Pros Describe Programs

The WHAT layer

The WHAT + HOW layer

  • The broad WHAT layer is written for .
  • The detailed WHAT + HOW layer is written for .

Same program, two audiences: users need the WHAT; the developers who maintain it need the WHAT + HOW.

Stop and think

  1. A classmate calls the 12 lines that check password strength inside a login app 'a program.' Correct them with the precise term and the reason it applies.
  2. Write BOTH description levels for a spell-checker: one broad sentence, then a 2–3 step detailed version that includes how it might accomplish the job.
  3. A ticket-buying program was tested only with the number 2. List two other inputs it must handle that says so.

Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 1.2 page.

Today in one box

  • Computing innovations exist for two purposes: solving problems or pursuing interests through creative expression
  • Understanding the purpose gives developers an improved ability to build the innovation
  • A program (software) performs a specific task when run; a code segment is a part of one; behavior is how it functions during execution
  • A program must work for a variety of inputs — and can be described broadly (what) or in detail (what + how)

Before next class: Before tomorrow, notice this: your phone reacts the INSTANT you tap it — no matter what it was doing. Nothing was 'next in line.' So how did your tap jump the queue? Bring a theory.

Day 2: Nothing Was Next in Line

Today’s objectives

  • Identify the input(s) to a program — their forms (tactile, audio, visual, text), their sources (users or other programs), and the events that supply them (LO CRD-2.C)
  • Identify the output(s) produced by a program — data sent to a device, based on the program's input or its prior state (LO CRD-2.D)

Bell ringer

Yesterday's teaser: your phone reacts the INSTANT you tap — mid-video, mid-download, mid-anything. Nothing was 'next in line.' Compare: a cake recipe runs step 1, step 2, step 3, and never jumps.

Write your theory: how does the phone 'know' to run the tap-handling code right now? Is the phone following a recipe? If not, what is it doing while it waits for you?

01. Inputs and Events

Key Vocabulary (LO CRD-2.C & CRD-2.D)

Term Definition (write it)
Program input
Event
Event-driven programming
Sequential flow of control
Program output

Input: Four Forms, Two Sources

  • The CED's four example input forms are .
  • Input can come from a user or from .
  • Inputs usually .

Sequential vs. Event-Driven

Sequential flow of control

Event-driven

  • In sequential flow, a statement runs because it is .
  • In event-driven programming, statements execute when .
  • Events can be generated when .

AP TIP: 'The code runs WHEN the user clicks' = event-driven. 'The code runs AFTER the previous line' = sequential. The trigger word tells you which.

Watch out — “Programs Always Run Top to Bottom”

Myth: Program statements always execute in order, first line to last — so whatever code just ran must have been the next line in the program.

Explain why this is wrong:

Stop and think

  1. You unlock a phone with your fingerprint, then say 'Play my playlist.' Name the form of each of those two inputs, using CED vocabulary.
  2. A stock-alert app shows no activity for three hours, then instantly pops a notification when a price feed reports a drop. Is this program sequential or event-driven? Name the event and what input it supplied.
  3. The price data in that alert came from the stock exchange's computers, not a person. What covers this — and what does it say about input sources?

Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 1.2 page.

02. Outputs

Output: Data Leaving for a Device

  • Program outputs are any data sent from a program to .
  • Output is usually based on a program's input or its .
  • Same input but different output usually means .

Input In, Output Out — Four Scenarios

For each scenario: identify the input's source and form, then the output's form.

Complete the empty cells.

Scenario Input — source & form Output — form
You say 'What's the capital of Peru?' and the smart speaker answers aloud User · audio (spoken question)
You type a wrong password; the phone shows 'Try again' and buzzes in your hand Visual (message) + tactile (vibration)
A weather service's software sends storm data; the dashboard displays a radar map Visual (radar map)
You scan a ticket's QR code; the gate program prints a receipt slip User · visual (camera image of the code)

Deep Dive · Beyond the AP Exam

Deep Dive: The Event Loop

What it looks like

What's really happening

  • While an event-driven app 'waits,' a hidden loop is constantly .
  • A 'frozen' app is usually .

One loop, millions of apps: nearly every GUI, game, and phone app you've used is an event loop wearing a costume.

Stop and think

  1. A fitness watch buzzes on your wrist and shows 'Goal reached!' after your 10,000th step. Identify each output and its form.
  2. A music app's shuffle button is tapped twice, ten minutes apart, and queues a different song each time. Explain why identical inputs legally produced different outputs.
  3. A student claims a program that sends data to a printer 'has no output because nothing appeared on screen.' Correct the claim with's exact standard.

Answer in complete sentences. Then check yourself with the matching CFUs on the Topic 1.2 page.

Common AP Traps

Three ways Topic 1.2 loses points on the exam — one minute now, real points in May.

Purpose vs. function — in your own words:

Event-driven ≠ sequential — in your own words:

Same input, different output — in your own words:

Program Function and Purpose, in One Slide

  • Innovations exist to solve problems or to pursue interests through creative expression — and knowing which improves the developer's work.
  • A program (software) performs a specific task when run; a code segment is part of one; behavior is how it functions during execution.
  • A program must work for a variety of inputs, and can be described broadly (what) or in detail (what + how).
  • Inputs — tactile, audio, visual, text — come from users or other programs, supplied by events; event-driven code runs when triggered, not in sequence.
  • Outputs are any data sent to a device, usually based on the input or the program's prior state.

Exit check — I can…

  • ☐  describe a computing innovation's purpose using the CED's two categories (LO CRD-2.A)
  • ☐  explain how a program or code segment functions at both description levels — what, and what + how (LO CRD-2.B)
  • ☐  identify a program's inputs, their forms and sources, and the events that supply them (LO CRD-2.C)
  • ☐  identify a program's outputs and explain how they depend on input and prior state (LO CRD-2.D)

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]