AP CSP
AP Computer Science Principles / All lessons / Big Idea 1: Creative Development
1Big Idea 1: Creative Development
AP CSP topic 1.2

Program Function and Purpose

Every program is written for a purpose: to solve a problem or to let people express themselves creatively. A program takes inputs, such as clicks, typed text, or sensor readings, processes them, and produces outputs, such as text, sound, or movement. Many programs are event driven, which means code runs when something happens, like a button being pressed. Describing what a program does, its behavior, is different from describing the code that makes it work.

Program Function and Purpose vocabulary

  • Program: A collection of instructions that a computer follows to do a task.
  • Input: Data sent to a program, from a user, a device, or another program.
  • Output: Data a program sends out, such as text on a screen, a sound, or a file.
  • Event: An action, like a key press or mouse click, that triggers code to run.

AP-style practice questions

Try each one, then open the answer. To save your progress, take this quiz in the interactive course.

Skill: Computational Solution Design
A smart thermostat reads the room temperature every minute. If the temperature is below the setting, it turns on the heater and shows "Heating" on its screen.

1. Which of the following is an input to the thermostat program?

  1. (A) The word "Heating" on the screen
  2. (B) The heater turning on
  3. (C) The room temperature reading
  4. (D) The thermostat's plastic case
Show answer

(C) The room temperature reading The temperature reading is data sent into the program; the screen text and heater are outputs.

Skill: Computational Solution Design

2. A music app plays a song when a user taps its title. Which of the following best describes this kind of program behavior?

  1. (A) The program runs only once and then stops
  2. (B) Code runs in response to an event, the user's tap
  3. (C) The program ignores all user input
  4. (D) The program runs the same code in a loop forever
Show answer

(B) Code runs in response to an event, the user's tap Event-driven programs run code when an event, such as a tap, happens.

Skill: Computing Innovations

3. Which of the following best describes the purpose of a program that lets users create digital art by dragging shapes on a screen?

  1. (A) To solve a math problem
  2. (B) To allow creative expression
  3. (C) To store data for a bank
  4. (D) To route internet traffic
Show answer

(B) To allow creative expression Programs are written to solve problems or to enable creative expression. This one is creative.

Skill: Computational Solution Design

4. A student describes a program by saying, "When you type a city name, it shows today's weather there." What is the student describing?

  1. (A) The program's code
  2. (B) The program's behavior
  3. (C) The program's file size
  4. (D) The programming language used
Show answer

(B) The program's behavior Behavior is what a program does when run, described without the code.

Open 1.2 in the interactive course