| English | 释义 | 拼音 |
|---|---|---|
| purpose/ˈpɜːpəs/ | 目的 | mù dì |
| function/ˈfʌŋkʃn/ | 功能 | gōng néng |
| behavior/bɪˈheɪvjə/ | 行为 | xíng wéi |
| Input/ˈɪnpʊt/ | 输入 | shū rù |
| Processing/ˈprəʊsesɪŋ/ | 处理 | chǔ lǐ |
| Output/ˈaʊtpʊt/ | 输出 | shū chū |
| events/ɪˈvents/ | 事件 | shì jiàn |
| event-driven/ɪˈvent ˈdrɪvən/ | 事件驱动 | shì jiàn qū dòng |
| event handler/ɪˈvent ˈhændlə/ | 事件处理程序 | shì jiàn chǔ lǐ chéng xù |
Purpose vs function
- Before writing code, be clear about two related ideas.
- The purpose 目的 of a program is why it exists — the problem it solves.
- The function 功能 is what it does — the behavior a user sees.
- A weather app's purpose is "help people plan"; its function is "show the forecast."
Input, processing, or output?
Every program takes input, processes it by its instructions, and produces output. Sort each part of a program into the right stage.
A program's purpose is why it exists; its function is:
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Purpose = the goal; function = the visible behavior that reaches it.
Which is an example of input?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
A tap is data the program receives; the others are outputs.
The input → processing → output model
- Every program follows a simple model: input → processing → output (the IPO model).
- Input 输入: data the program receives — typing, a sensor, a file, the internet.
- Processing 处理: the steps it performs on that input.
- Output 输出: the result — text, a sound, a saved file, a robot moving.

Every program decomposes into input, processing, and output
Put the IPO model in order.
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
Data comes in, is processed, and a result goes out.
A program that waits and reacts to clicks and key presses is ______-driven.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Each event triggers an event handler.
A program always gives the same output, whatever input it receives.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
False. A program's behavior is how it responds to input, so different inputs can give different outputs.
Behavior and events
- A program's behavior 行为 is how it responds to inputs — different inputs can give different outputs.
- Many modern programs are event-driven 事件驱动: they wait and react to events 事件 like a click or a key press.
- Each event triggers a small piece of code called an event handler 事件处理程序.
- A game, a website button, and a chat app are all event-driven.
A well-designed program should: (Select all that apply)
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Good design also handles every possible input, including unusual ones.
What a well-designed program does
- Solves a genuine problem for its users.
- Is clear about the input it expects and the output it gives.
- Does its job reliably every time it runs.
- Thinking about every possible input is part of designing it correctly.
Worked example: a step-counter app
A step-counter app helps people stay active. It reads the phone's motion sensor, counts each step, and shows the day's total; when the user taps "Reset", the count goes back to zero. Identify its purpose, function, input, processing, output and an event.
- Purpose: help people stay active. Function: count and display steps. Input: motion sensor data and taps on the screen.
- Processing: detect a step pattern in the sensor data and add 1 to the count. Output: the step total on screen. Event: tapping "Reset" triggers its event handler, which sets the count to 0.
In a calculator app, the user typing "7 × 6" is the:
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
It is data given to the program.
In an event-driven program, code runs in response to actions such as a click or key press.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Each event triggers its handler.
A program's purpose is why it exists; its function is what it does. Every program fits input → processing → output (the IPO model). Its behavior is how it responds to inputs — and many programs are event-driven, reacting to clicks and key presses through event handlers.