AP Computer Science Principles · 鼎睿学苑

Unit 1: Creative Development

单元 1:创造性开发

Explore how people design, develop, and test programs that meet user needs. Practice explaining behavior and finding errors.

探索人们如何协作设计、开发和测试满足用户需求的程序。练习解释程序行为并识别错误。

10–13% of AP Exam MCQ占 AP 选择题 10–13%Big Idea 1 · CRD大概念 1 · CRD4 Topics4 个小节

Collaboration

协作

Must know
  • A computing innovation includes a program as an integral part of its function. It can be physical, software, or a computing concept. (CRD-1.A.1, CRD-1.A.2)
  • Effective collaboration combines diverse talents and perspectives; diverse perspectives also help avoid bias. (CRD-1.A.3, CRD-1.A.4)
  • Consulting users and gathering information from potential users help developers understand a program's purpose and incorporate diverse perspectives. (CRD-1.A.5, CRD-1.A.6)
  • Online tools let programmers share ideas and documents and provide feedback. (CRD-1.B.1)
  • Pair programming is a common model that facilitates collaboration. (CRD-1.B.2)
  • Effective teams practice communication, consensus building, conflict resolution, and negotiation. (CRD-1.C.1)
必备知识
  • 计算创新(computing innovation)的功能以程序为不可或缺的组成部分。它可以是实体、软件或计算概念。 (CRD-1.A.1, CRD-1.A.2)
  • 有效协作(collaboration)融合不同的才能和观点;多样化的观点也有助于避免偏见(bias)。 (CRD-1.A.3, CRD-1.A.4)
  • 咨询用户并向潜在用户收集信息,有助于开发者理解程序的目的并纳入多样化的观点。 (CRD-1.A.5, CRD-1.A.6)
  • 在线工具让程序员分享想法和文档,并提供反馈。 (CRD-1.B.1)
  • 结对编程(pair programming)是一种促进协作的常见模式。 (CRD-1.B.2)
  • 高效团队运用沟通、达成共识(consensus building)、解决冲突(conflict resolution)和协商(negotiation)等人际交往技能。 (CRD-1.C.1)

What collaboration improves

协作能带来什么改进

A self-driving car is a physical computing innovation, picture editing software is a nonphysical one, and e-commerce is a nonphysical computing concept. Each includes a program as an integral part of its function.

自动驾驶汽车是一种实体计算创新,图片编辑软件是一种非实体计算创新,电子商务则是一种非实体计算概念。它们的功能都以程序为不可或缺的组成部分。

People bring different talents and perspectives to a project. Consulting and communicating with users can reveal different views of a program's purpose. Developers can use that information to incorporate those views and help avoid bias.

项目成员会带来不同的才能和观点。咨询用户并与用户沟通,可以发现人们对程序目的的不同看法。开发者可以利用这些信息纳入不同观点,并帮助避免偏见。

How teams collaborate

团队如何协作

Teams can use online tools to share ideas and documents and give feedback. Pair programming is one model for working together. Team members also communicate, build consensus, resolve conflicts, and negotiate when they need to make decisions together.

团队可以使用在线工具分享想法和文档并给出反馈。结对编程是一种合作模式。需要共同做决定时,团队成员也要沟通、达成共识、解决冲突并进行协商。

Exam pattern: explain the improvement by connecting a specific perspective or feedback to a development decision, rather than just saying that teamwork is helpful.

考试常见思路:把具体的观点或反馈与开发决策联系起来,解释它如何带来改进,而不是只说团队合作有帮助。

Worked Example: Gathering User Perspectives例题:收集用户观点

A team is developing a picture editing program. One potential user wants simple controls; another wants more editing choices. Team members share both comments in an online document and disagree about what to include. How can collaboration improve the program?

一个团队正在开发图片编辑程序。一位潜在用户希望操作控件简单,另一位希望有更多编辑选项。团队成员在在线文档中分享了这两条意见,但对应该加入什么功能存在分歧。协作如何改进程序?

  1. Consulting different potential users reveals different views of the program's purpose: easy editing and access to more choices.
  2. The shared document lets team members review and provide feedback on both ideas.
  3. The members discuss the disagreement and negotiate a design with simple controls and additional editing choices, reaching consensus.
  4. Answer: The program can reflect both perspectives rather than only one group's preference. This helps the team avoid bias in its design.
  1. 咨询不同的潜在用户,可以发现他们对程序目的的不同看法:轻松编辑,以及使用更多选项。
  2. 共享文档让团队成员能够查看这两种想法并提供反馈。
  3. 成员讨论分歧,协商出同时提供简单控件和更多编辑选项的设计,并达成共识。
  4. 答案:程序可以体现这两种观点,而不是只体现某一类人的偏好。这有助于团队避免设计中的偏见。
Exam trap A classic wrong answer is that asking only the developers for their opinions is enough to represent users. Developers may miss user needs; consultation with potential users brings in perspectives the team might otherwise overlook.
考试陷阱 一个常见错误答案是:只询问开发者的意见就足以代表用户。开发者可能忽略用户需求;咨询潜在用户可以引入团队原本可能忽视的观点。
Going deeper Diverse perspectives help avoid bias, but collaboration alone does not guarantee an unbiased design. Consider whose feedback has been gathered and whether the resulting decisions actually incorporate it. Different user requests can conflict, so the team may need negotiation and consensus building.
深入理解 多样化的观点有助于避免偏见,但协作本身并不保证设计没有偏见。要考虑团队收集了哪些人的反馈,以及最终决策是否真正纳入了这些反馈。不同用户的要求可能互相冲突,因此团队可能需要协商并达成共识。

Program Function and Purpose

程序的功能与目的

Must know
  • A computing innovation can solve a problem or pursue an interest through creative expression. Knowing its purpose helps developers build it. (CRD-2.A.1, CRD-2.A.2)
  • A program is a collection of statements that performs a task when run. A code segment is part of a program. A program needs to work for varied inputs and situations. (CRD-2.B.1, CRD-2.B.2, CRD-2.B.3)
  • Behavior is how a program functions during execution. Describe a program broadly by what it does, or in detail by also explaining how its statements do it. (CRD-2.B.4, CRD-2.B.5)
  • Input is data sent to a computer for processing. It can come from a user or another program and can be tactile, audio, visual, or text. Input usually affects output. (CRD-2.C.1, CRD-2.C.4, CRD-2.C.6)
  • An event is associated with an action and supplies input data. Events such as key presses, clicks, or program starts can affect execution. In event-driven programming, statements run when triggered rather than through sequential control flow. (CRD-2.C.2, CRD-2.C.3, CRD-2.C.5)
  • Output is data sent from a program to a device. It can be tactile, audio, visual, or text, and is usually based on input or prior state. (CRD-2.D.1, CRD-2.D.2)
必备知识
  • 计算创新(computing innovation)可以解决问题,也可以通过创意表达来追求兴趣。了解其目的有助于开发者进行开发。(CRD-2.A.1, CRD-2.A.2)
  • 程序(program)是计算机运行时执行特定任务的一组语句。代码段(code segment)是程序的一部分。程序需要适用于多种输入和情况。(CRD-2.B.1, CRD-2.B.2, CRD-2.B.3)
  • 行为(behavior)是程序执行时的运行方式。可以概括描述程序做什么,也可以进一步解释语句如何实现该功能。(CRD-2.B.4, CRD-2.B.5)
  • 输入(input)是发送给计算机、由程序处理的数据。输入可来自用户或其他程序,形式可以是触觉、音频、视觉或文本。输入通常会影响输出。(CRD-2.C.1, CRD-2.C.4, CRD-2.C.6)
  • 事件(event)与一个动作相关联,并向程序提供输入数据。按键、点击或程序启动等事件可以影响执行流程。在事件驱动编程(event-driven programming)中,语句由触发执行,而不是通过顺序控制流执行。(CRD-2.C.2, CRD-2.C.3, CRD-2.C.5)
  • 输出(output)是程序发送到设备的数据。输出可以是触觉、音频、视觉或文本形式,通常基于输入或先前状态。(CRD-2.D.1, CRD-2.D.2)

Purpose, function, and behavior

目的、功能与行为

Purpose explains why an innovation exists: it may address a problem or support creative expression. Understanding that purpose helps developers make decisions about what to build.

目的说明一项创新为何存在:它可能用于解决问题,也可能支持创意表达。理解目的有助于开发者决定要构建什么。

A program, often called software, is a collection of statements that performs a specific task when a computer runs it. A code segment is only part of a program. Behavior describes what happens during execution, often in terms of how a user interacts with the program.

程序通常也称为软件,是计算机运行时执行特定任务的一组语句。代码段只是程序的一部分。行为描述执行时发生的情况,通常结合用户如何与程序交互来说明。

Exam pattern: identify the input and output, then explain what the program does. For a detailed explanation, trace how the statements turn the input or prior state into the observed result. Consider more than one input or situation.

考试常见模式:先识别输入和输出,再解释程序做什么。需要详细说明时,追踪语句如何将输入或先前状态转化为观察到的结果。要考虑不止一种输入或情况。

Inputs, events, and outputs

输入、事件与输出

Input can come from a user or another program. An event is associated with an action and supplies input data. A key press, mouse click, program start, or another defined action can generate an event that affects execution. In event-driven programming, an event triggers statements instead of those statements simply running as part of a sequential flow.

输入可以来自用户或其他程序。事件与一个动作相关联,并提供输入数据。按键、鼠标点击、程序启动或其他已定义的动作都可以生成影响执行的事件。在事件驱动编程中,事件触发语句执行,而不是让这些语句仅作为顺序流程的一部分运行。

Both input and output can take forms such as text, visual, audio, or tactile data. Output goes from a program to a device. It is usually based on input or prior state, such as internal values, so it is not necessarily determined by the current input alone.

输入和输出都可以采用文本、视觉、音频或触觉等形式。输出从程序发送到设备。它通常基于输入或先前状态,例如内部数值,因此不一定只由当前输入决定。

Worked Example: Trace a doubling program例题:追踪倍数计算程序

A program is intended to help a user find twice a number. The user enters 7. Identify the input and output, and explain how the program works.

一个程序旨在帮助用户求出一个数的两倍。用户输入 7。请识别输入和输出,并解释程序如何运行。

number ← INPUT()
result ← number * 2
DISPLAY(result)
  1. INPUT() accepts 7, so the input is 7 and number becomes 7.
  2. The second statement multiplies 7 by 2 and stores 14 in result.
  3. DISPLAY(result) displays 14 followed by a space. That displayed value is the output.
  4. Answer: the program doubles the input by storing twice its value and displaying the result. For input 0, it displays 0 followed by a space instead.
  1. INPUT() 接收 7,因此输入是 7,number 的值变为 7。
  2. 第二条语句将 7 乘以 2,并把 14 存入 result。
  3. DISPLAY(result) 显示 14,后面带一个空格。显示的值就是输出。
  4. 答案:程序通过存储输入值的两倍并显示结果,来实现倍数计算。若输入为 0,则显示 0,后面带一个空格。
Exam trap

Do not call an internal value an output just because the program calculated it. In the example, result is an internal value; it becomes displayed output when DISPLAY sends its value to a device. Also, “it doubles a number” describes what the program does, not how its statements accomplish it.

考试陷阱

不要仅因为程序计算出了某个内部值,就把它称为输出。例题中的 result 是内部值;当 DISPLAY 将其值发送到设备时,它才成为显示输出。另外,“它将一个数翻倍”说明的是程序做什么,并未解释语句如何实现这一功能。

Going deeper

One successful input does not establish that a program works in every relevant situation. Trace different inputs and consider prior state when predicting output. Two runs with the same current input can produce different outputs if the program uses different prior internal values.

深入理解

一个输入得到正确结果,并不能证明程序在所有相关情况下都能正常运行。预测输出时,应追踪不同输入并考虑先前状态。如果程序使用的先前内部值不同,两次运行即使当前输入相同,输出也可能不同。


Program Design and Development

程序设计与开发

Must know
  • Development can be ordered or exploratory. Common phases include investigation and reflection, design, prototyping, and testing. Iterative development revises work; incremental development builds working pieces into a whole. (CRD-2.E.1, CRD-2.E.2, CRD-2.E.3, CRD-2.E.4)
  • Investigate requirements, constraints, and users’ concerns and interests through surveys, user testing, interviews, or direct observations. (CRD-2.F.1, CRD-2.F.2, CRD-2.F.3)
  • A specification defines requirements. Design outlines how to meet it, including possible interface layouts and a testing strategy. (CRD-2.F.4, CRD-2.F.5, CRD-2.F.6, CRD-2.F.7)
  • Document function and development throughout the process. Comments are documentation for people and do not affect execution; other documentation may be needed. (CRD-2.G.1, CRD-2.G.2, CRD-2.G.3, CRD-2.G.4, CRD-2.G.5)
  • Acknowledge collaborative or externally sourced code. Documentation can credit its origin or original author. (CRD-2.H.1, CRD-2.H.2)
必备知识
  • 开发可以有序进行,也可以采用探索方式。常见阶段包括调查与反思、设计、原型制作和测试。迭代开发(iterative development)反复修改;增量开发(incremental development)将可运行的小部分逐步加入整体。(CRD-2.E.1, CRD-2.E.2, CRD-2.E.3, CRD-2.E.4)
  • 通过问卷、用户测试、访谈或直接观察,调查需求、约束以及用户的顾虑和兴趣。(CRD-2.F.1, CRD-2.F.2, CRD-2.F.3)
  • 规格说明(specification)定义需求。设计概述如何满足规格,可包括界面布局和测试策略。(CRD-2.F.4, CRD-2.F.5, CRD-2.F.6, CRD-2.F.7)
  • 在整个开发过程中记录程序功能和开发过程。注释(comments)是供人阅读的文档,不影响程序运行;有时需要其他文档方式。(CRD-2.G.1, CRD-2.G.2, CRD-2.G.3, CRD-2.G.4, CRD-2.G.5)
  • 应注明协作编写或来自外部的代码。可以在文档中注明其来源或原作者。(CRD-2.H.1, CRD-2.H.2)

Development processes

开发过程

There is more than one development process. A team may follow an ordered, intentional approach or explore ideas as it works. Common phases are investigating and reflecting, designing, prototyping, and testing. An iterative process uses feedback, testing, or reflection to refine work throughout development and may return to an earlier phase.

开发过程不止一种。团队可以按有序、有计划的方式进行,也可以边开发边探索想法。常见阶段有调查与反思、设计、制作原型(prototyping)和测试。迭代过程在整个开发中利用反馈、测试或反思来改进成果,并可能返回先前的阶段。

An incremental process breaks a problem into smaller pieces and checks that each piece works before adding it to the whole. For exam questions, distinguish revising existing work from adding a working piece. A process can do both.

增量过程把问题拆成较小的部分,确保每部分能正常工作后再将其加入整体。考试中要区分修改已有成果和加入可运行的部分。一个过程可以同时采用这两种方式。

Investigation and design

调查与设计

Investigation helps identify requirements, constraints, and the concerns and interests of intended users. Developers can collect survey data, conduct user tests or interviews, and make direct observations. Requirements describe how a program functions and may describe interactions it must provide. The specification defines those requirements.

调查有助于确定需求、约束(constraints)以及目标用户的顾虑和兴趣。开发者可以收集问卷数据、进行用户测试或访谈,也可以直接观察。需求描述程序如何运行,也可能描述程序必须提供的用户交互。规格说明定义这些需求。

Design outlines how to meet the specification. It may include brainstorming, planning and storyboarding, organizing modules and functional components, drawing user-interface layouts, and developing a testing strategy.

设计概述如何满足规格说明。设计可包括头脑风暴、规划和制作分镜(storyboarding)、组织模块与功能组件、绘制用户界面(user interface)布局图,以及制定测试策略。

Documentation and acknowledgment

文档与代码来源说明

Program documentation is a written description of the function of a code segment, event, procedure, or program and how it was developed. Write it throughout development. It helps individuals and teams develop and maintain correct programs. Comments are written into a program for people to read; they do not affect how it runs. Some environments do not support comments, so documentation may need to be kept another way.

程序文档(program documentation)是对代码段、事件、过程(procedure)或程序的功能及其开发方式的书面描述。应在整个开发过程中编写文档。文档有助于个人和团队开发、维护正确的程序。注释写在程序中,供人阅读,不影响程序运行。有些环境不支持注释,因此可能需要用其他方式保存文档。

Acknowledge code developed collaboratively or obtained from another source. For code written by someone else, the documentation can identify its origin or original author.

应注明协作开发或来自其他来源的代码。对于他人编写的代码,可以在文档中注明其来源或原作者。

Worked Example: Designing a doubling program例题:设计一个将数值翻倍的程序

A team investigates a program for users who want to enter a number and see twice its value. The specification requires a numeric input and a displayed result. Teammate Lin wrote the display calculation in this prototype:

某团队调查一个程序:用户希望输入一个数并看到它的两倍。规格说明要求输入数值并显示结果。队友 Lin 编写了这个原型中的显示计算部分:

number ← INPUT()
DISPLAY(number * 2)
  1. Design the interaction: provide a way to enter a number and a place to show the result. Plan a test with input 3 and expected value 6.
  2. Trace the prototype: INPUT() supplies 3, so number * 2 is 6. The program displays 6 followed by a space.
  3. If user testing shows that the interaction is unclear, revise the interface design and test again. This is iteration. Building and checking another required piece before adding it would be incremental development.
  4. Document that the program takes a number and displays twice its value, describe how it was developed, and credit Lin for the display calculation. Answer: the prototype produces the expected value 6 for this test.
  1. 设计交互:提供输入数值的方式和显示结果的位置。计划用输入 3 测试,预期结果为 6。
  2. 跟踪原型:INPUT() 提供 3,因此 number * 2 为 6。程序显示 6,后面带一个空格。
  3. 如果用户测试表明交互不够清晰,就修改界面设计并再次测试。这是迭代。先构建并检查另一个所需部分,再把它加入程序,则是增量开发。
  4. 记录程序接收一个数并显示其两倍,描述开发过程,并注明显示计算部分由 Lin 编写。答案:该原型在此测试中产生预期值 6。
Exam trap

“Iterative” does not simply mean adding features one at a time. That describes incremental development when each piece is checked before integration. Iteration means refining and revising based on feedback, testing, or reflection.

考试陷阱

“迭代”不只是一次添加一个功能。如果每个部分在整合前都经过检查,这描述的是增量开发。迭代是根据反馈、测试或反思进行改进和修改。

Going deeper

A successful test of one input does not establish that the entire program is correct. Compare test results with the specification, and use user feedback to decide whether to revisit the design. Keep documentation and code credits up to date as the program changes, even if the environment does not support comments.

深入理解

一个输入的测试成功,并不能证明整个程序都正确。应将测试结果与规格说明比较,并利用用户反馈决定是否重新审视设计。即使环境不支持注释,也要随着程序变化及时更新文档和代码来源说明。


Identifying and Correcting Errors

识别与纠正错误

Must know
  • A logic error causes incorrect or unexpected behavior; a syntax error breaks a programming language rule. (CRD-2.I.1, CRD-2.I.2)
  • A run-time error occurs during execution; an overflow error occurs when a number is outside a defined range. (CRD-2.I.3, CRD-2.I.4)
  • Find and correct errors using test cases, hand tracing, visualizations, debuggers, or extra output statements. (CRD-2.I.5)
  • Use requirements to choose test inputs and expected outcomes, then use the results to revise the program. (CRD-2.J.1, CRD-2.J.3)
  • Test inputs at and just beyond the minimum and maximum to check different expected outcomes. (CRD-2.J.2)
必备知识
  • 逻辑错误(logic error)会导致不正确或意外的行为;语法错误(syntax error)违反编程语言的规则。(CRD-2.I.1, CRD-2.I.2)
  • 运行时错误(run-time error)在程序执行期间发生;溢出错误(overflow error)发生在数值超出规定范围时。(CRD-2.I.3, CRD-2.I.4)
  • 可使用测试用例(test cases)、手动追踪(hand tracing)、可视化、调试器(debuggers)或额外输出语句来查找并纠正错误。(CRD-2.I.5)
  • 依据程序要求选择测试输入和预期结果,再利用测试结果修改程序。(CRD-2.J.1, CRD-2.J.3)
  • 测试最小值、最大值及刚好超出两端的输入,检查不同的预期结果。(CRD-2.J.2)

Recognize the error

识别错误

A program can follow the language rules and still have a logic error. Compare what it does with what the requirements say it should do. A syntax error instead violates a language rule. A run-time error happens while the program is running; programming languages define their own run-time errors.

程序即使遵守语言规则,仍可能有逻辑错误。应比较程序的实际行为和要求中的预期行为。语法错误则是违反语言规则。运行时错误发生在程序运行期间;不同编程语言会定义各自的运行时错误。

Overflow concerns a number outside a computer's defined range of values. It is different from a logic error such as using the wrong comparison.

溢出指计算机处理的数值超出其规定的取值范围。它不同于使用错误比较条件这类逻辑错误。

Test, trace, and revise

测试、追踪与修改

Exam pattern: start with the requirements, choose inputs and their expected outcomes, then trace or run the program and compare. If an outcome differs, locate the error, revise the program, and test again. Hand tracing tracks values step by step. Visualizations, debuggers, and extra output statements can also help reveal what happens during execution.

考试常见方法:先看程序要求,选择输入及其预期结果,再追踪或运行程序并进行比较。如果结果不同,就定位错误、修改程序并再次测试。手动追踪会逐步记录数值;可视化、调试器和额外输出语句也有助于观察执行过程。

Worked Example: Test a boundary例题:测试边界

A program must accept integer inputs from 1 through 10, inclusive, and reject other integers. Identify and correct the error.

某程序必须接受从 1 到 10(包含两端)的整数输入,并拒绝其他整数。请识别并纠正错误。

n ← INPUT()
IF(n > 1 AND n ≤ 10)
{
  DISPLAY("accepted")
}
ELSE
{
  DISPLAY("rejected")
}
  1. From the requirements, inputs 1 and 10 should display accepted; inputs 0 and 11 should display rejected.
  2. Trace input 1: n > 1 is false, so the program displays rejected. This differs from the expected result.
  3. The lower-bound comparison is a logic error. Replace n > 1 with n ≥ 1.
  4. With that correction, inputs 1 and 10 are accepted, while 0 and 11 are rejected. The corrected condition is n ≥ 1 AND n ≤ 10.
  1. 根据要求,输入 1 和 10 应显示 accepted;输入 0 和 11 应显示 rejected。
  2. 追踪输入 1:n > 1 为假,因此程序显示 rejected,与预期结果不同。
  3. 下界比较存在逻辑错误。将 n > 1 改为 n ≥ 1。
  4. 修改后,输入 1 和 10 被接受,0 和 11 被拒绝。正确条件是 n ≥ 1 AND n ≤ 10。
Exam trap

Wrong answer: “The program has no error because it runs.” A program can run but still produce the wrong result. Compare its behavior with the requirements, especially at the boundaries.

考试陷阱

错误答案:“程序能运行,所以没有错误。”程序即使能运行,也可能产生错误结果。要将实际行为与要求比较,尤其要检查边界。

Going deeper

Passing the boundary tests does not prove every input is correct. Also test an input inside the range, such as 2, and compare its result with the required outcome. After any revision, rerun relevant tests to check the change.

深入理解

通过边界测试并不能证明所有输入的结果都正确。还应测试范围内的输入,例如 2,并将结果与要求比较。每次修改后,重新运行相关测试以检查改动。


Create Performance Task

创作表现性任务

What the task is and how it is assessed
  • The Create performance task asks you to design and implement a program that might solve a problem, enable innovation, explore personal interests, or express creativity. Your submission must include the elements listed in the Submission Requirements. (CED p. 197)
  • You are allowed to collaborate with your partner(s) on the development of the program only. The video and Personalized Project Reference that you submit for this performance task must be completed individually, without any collaboration with your partner(s) or anyone else. You can develop the code segments used in your Personalized Project Reference with your partner(s) or on your own as you work on the performance task during class. (CED p. 197)
  • Once your teacher has assigned this performance task as one of your AP score components, you are expected to complete the task without assistance from anyone except for your partner(s) and then only when developing the program code. You must follow the Guidelines for Completing the Create Performance Task. (CED p. 197)
  • You will be provided with a minimum of 9 hours of class time to complete and submit: final program code (created independently or collaboratively); a video that displays the running of your program and demonstrates functionality you developed (created independently); and code segments for your Personalized Project Reference (created independently). (CED p. 197)
  • The AP Exam consists of the Create performance task and an end-of-course AP Exam. The Create performance task requires at least 9 hours of dedicated class time for students to complete. (CED p. 163)
  • The end-of-course exam is 3 hours long and includes 70 multiple-choice questions and 2 written response questions related to the Create performance task. The two questions include four distinct prompts: Written Response 1, Written Response 2(a), Written Response 2(b), and Written Response 2(c). (CED p. 163)
  • Students will be given their student-authored Personalized Project Reference to use when answering these written response prompts. (CED p. 163)
  • Exam weighting: multiple-choice questions are 70 questions, 70% weighting, 120 minutes; the Create Performance Task is 30% weighting, with program code, video, and Personalized Project Reference, and at least 9 hours in class; the written response questions are 2 questions, 60 minutes, on the end-of-course AP Exam. (CED p. 187)
任务内容与评估方式
  • 创作表现性任务要求你设计并实现一个程序,它可能用于解决问题、促进创新、探索个人兴趣或表达创造力。你的提交必须包括“提交要求”中列出的要素。 (CED p. 197)
  • 你只可以在程序开发过程中与搭档协作。你为此表现性任务提交的视频和个性化项目参考必须由你个人完成,不得与搭档或任何其他人协作。你可以在课堂完成此表现性任务期间,与搭档或独自开发用于个性化项目参考的代码段。 (CED p. 197)
  • 一旦你的老师将此表现性任务分配为你的 AP 评分组成部分之一,你应在完成该任务时不接受任何人协助,搭档除外,且仅在开发程序代码时接受协助。你必须遵守“完成创作表现性任务指南”。 (CED p. 197)
  • 你将获得至少 9 小时的课堂时间来完成并提交:最终程序代码(独立或协作创建);展示程序运行并演示你所开发功能的视频(独立创建);以及用于个性化项目参考的代码段(独立创建)。 (CED p. 197)
  • AP 考试由创作表现性任务和课程结束 AP 考试组成。创作表现性任务需要至少 9 小时的专门课堂时间供学生完成。 (CED p. 163)
  • 课程结束考试时长 3 小时,包括 70 道多项选择题和 2 道与创作表现性任务相关的书面回答题。这两道题包含四个不同的提示:书面回答 1、书面回答 2(a)、书面回答 2(b) 和书面回答 2(c)。 (CED p. 163)
  • 学生将获得自己撰写的个性化项目参考,用于回答这些书面回答提示。 (CED p. 163)
  • 考试权重:多项选择题为 70 道题,权重 70%,120 分钟;创作表现性任务权重 30%,包括程序代码、视频和个性化项目参考,并在课堂上至少 9 小时;书面回答题为 2 道题,60 分钟,在课程结束 AP 考试中进行。 (CED p. 187)
Program requirements checklist
  • Submit one PDF file that contains all of your program code (including comments). Include comments or acknowledgments for any part of the submitted program code that has been written by someone other than you and/or your collaborative partner(s). If the programming environment allows you to include comments, this is the preferred way to acknowledge and give credit to another author; if it does not, you can add them in a document editor when you capture your program code for submission. (CED p. 198)
  • Include instructions for input from one of the following: the user (including user actions that trigger events); a device; an online data stream; or a file. (CED p. 198)
  • Use at least one list (or other collection type) to represent a collection of data that is stored and used to manage program complexity and help fulfill the program's purpose. The data abstraction must make the program easier to develop (alternatives would be more complex) or easier to maintain (future changes to the size of the list would otherwise require significant modifications to the program code). (CED p. 198)
  • Include at least one procedure that contributes to the program's intended purpose, where you have defined the procedure's name, the return type (if necessary), and one or more parameters. Implementation of built-in or existing procedures or language structures, such as event handlers or main methods, are not considered student-developed. (CED p. 198)
  • Include an algorithm that includes sequencing, selection, and iteration that is in the body of the selected procedure. (CED p. 198)
  • Include calls to your student-developed procedure. (CED p. 198)
  • Include instructions for output (tactile, audible, visual, or textual) based on input and program functionality. (CED p. 198)
  • Program Requirements scoring row: the program code includes a list, a procedure, a call to the procedure, selection, and iteration. Consider the Personalized Project Reference (or Program Code if necessary) when scoring this point; if the program requirements do not appear in the Personalized Project Reference, consider the full program code file when scoring this point. The procedure does not need to have a parameter to earn this point; the code segments demonstrating selection and iteration do not need to appear in the same algorithm or be contained in a procedure. (CED p. 189)
  • Do NOT earn the Program Requirements point if any one or more of the following is true: the list is a one-element list; the use of the list is irrelevant or not used in the program; the use of either the selection or the iteration is trivial (i.e., does not affect the outcome of the program). (CED p. 189)
程序要求清单
  • 提交一个 PDF 文件,其中包含你的全部程序代码(包括注释)。对提交的程序代码中由你以外的任何人 和/或你的协作搭档编写的任何部分,包含注释或致谢。如果编程环境允许你添加注释,这是致谢并注明另一作者贡献的首选方式;如果不允许,你可以在截取程序代码用于提交时,在文档编辑器中添加注释。 (CED p. 198)
  • 包含来自以下之一的输入指令:用户(包括触发事件的用户操作);设备;在线数据流;或文件。 (CED p. 198)
  • 使用至少一个列表(或其他集合类型)来表示一组数据,这些数据被存储并用于管理程序复杂性且帮助实现程序目的。数据抽象必须使程序更易于开发(替代方案会更复杂)或更易于维护(否则未来列表大小的变化将需要对程序代码进行重大修改)。 (CED p. 198)
  • 包含至少一个有助于实现程序预期目的的过程,并且你已定义该过程的名称、返回类型(如有必要)以及一个或多个参数。内置或现有过程或语言结构(例如事件处理程序或 main 方法)的实现不被视为学生开发。 (CED p. 198)
  • 包含一个算法,该算法包括顺序、选择和迭代,并且位于所选过程的主体中。 (CED p. 198)
  • 包含对你学生开发的过程的调用。 (CED p. 198)
  • 包含基于输入和程序功能的输出指令(触觉、听觉、视觉或文本)。 (CED p. 198)
  • “程序要求”评分行:程序代码包括一个列表、一个过程、对该过程的调用、选择以及迭代。评分此分时考虑个性化项目参考(必要时考虑程序代码);如果程序要求未出现在个性化项目参考中,则评分此分时考虑完整的程序代码文件。过程不必有参数即可获得此分;展示选择和迭代的代码段不必出现在同一算法中,也不必包含在过程中。 (CED p. 189)
  • 如果以下任意一项或多项为真,则不能获得“程序要求”分:列表是单元素列表;列表的使用无关或未在程序中使用;选择或迭代的使用是微不足道的(即不影响程序结果)。 (CED p. 189)
Video requirements
  • Submit one video file that demonstrates the running of your program as described below. Collaboration is not allowed during the development of your video. (CED p. 199)
  • Your video must demonstrate your program running, including input to your program, at least one aspect of the functionality of your program, and output produced by your program. (CED p. 199)
  • Your video may NOT contain any distinguishing information about yourself. (CED p. 199)
  • Your video may NOT contain voice narration (though text captions are allowed). (CED p. 199)
  • Your video must be either .webm, .mp4, .wmv, .avi, or .mov format; no more than 1 minute in length; and no more than 30 MB in file size. (CED p. 199)
  • Video scoring row: the video demonstrates the running of the program including input, program functionality, and output. Consider only the video when scoring this point. Do NOT award a point if the video does not show a demonstration of the program running (screenshots or storyboards are not acceptable and would not be credited). (CED p. 189)
视频要求
  • 提交一个视频文件,按以下描述展示你的程序运行。视频开发过程中不允许协作。 (CED p. 199)
  • 你的视频必须展示程序运行,包括程序的输入、程序功能的至少一个方面,以及程序产生的输出。 (CED p. 199)
  • 你的视频不得包含任何可识别你身份的信息。 (CED p. 199)
  • 你的视频不得包含语音旁白(但允许文字说明)。 (CED p. 199)
  • 你的视频必须为 .webm、.mp4、.wmv、.avi 或 .mov 格式;长度不超过 1 分钟;文件大小不超过 30 MB。 (CED p. 199)
  • 视频评分行:视频展示程序运行,包括输入、程序功能和输出。评分此分时只考虑视频。如果视频未展示程序运行(截图或故事板不可接受,也不会得分),则不得分。 (CED p. 189)
Scoring guidelines: what earns each point

General scoring notes: responses should be evaluated solely on the rationale provided; responses must demonstrate all criteria, including those within bulleted lists, in each row to earn the point for that row. (CED p. 188)

Written Response 2 has three 0-1 point rows: 2(a), 2(b), and 2(c), for 3 points. (CED pp. 190-191)

  • Video (0-1 point): earns the point when the video demonstrates the running of the program including input, program functionality, and output; consider only the video; do NOT award if the video does not show a demonstration of the program running (screenshots or storyboards are not acceptable and would not be credited). (CED p. 189)
  • Program Requirements (0-1 point): earns the point when the program code includes a list, a procedure, a call to the procedure, selection, and iteration; consider the Personalized Project Reference (or Program Code if necessary), and if the program requirements do not appear in the Personalized Project Reference, consider the full program code file. Do NOT award if the list is a one-element list, the use of the list is irrelevant or not used in the program, or the use of either selection or iteration is trivial (i.e., does not affect the outcome of the program). The procedure does not need to have a parameter to earn this point; the code segments demonstrating selection and iteration do not need to appear in the same algorithm or be contained in a procedure. (CED p. 189)
  • Written Response 1: Program Design, Function, and Purpose (0-1 point): earns the point when the written response identifies an expected user of the program and describes one way the program's design meets the needs of the identified user; consider Written Response 1 and the student's Program Code; the response must relate the program design to the needs of the identified user. Do NOT award if the description of the design is implausible, inaccurate, or inconsistent with the program. (CED p. 189)
  • Written Response 2(a): Algorithm Development (0-1 point): the written response identifies the number of times the body of the iteration statement will execute AND describes a condition or error that would cause an infinite loop. (This is the CED's scoring guideline for its sample 2(a) prompt; the prompt on exam day may ask about a different aspect of your algorithm, so practise explaining your iteration in several ways.) Consider the Personalized Project Reference and Written Response 2(a); if multiple iteration statements are included in the Procedures section of the Personalized Project Reference, use the first iteration statement to determine whether the point is earned; the iteration statement does not need to be contained in a procedure. Do NOT award if the identified number of times the body of the iteration statement will execute does not match the code. (CED p. 191)
  • Written Response 2(b): Errors and Testing (0-1 point): earns the point when the written response describes a change to the procedure that will result in a run-time error and explains why the change will result in a run-time error; consider the Personalized Project Reference and Written Response 2(b); if multiple procedures are included in part (i) of the Procedures section of the Personalized Project Reference, use the first procedure to determine whether the point is earned. Do NOT award if a procedure is not identified in part (i) of the Procedures section of the Personalized Project Reference, the response does not apply to the procedure in part (i) of the Procedures section of the Personalized Project Reference, or the response describes expected behavior that is implausible, inaccurate, or inconsistent with the program. (CED p. 191)
  • Written Response 2(c): Data and Procedural Abstraction (0-1 point): earns the point when the written response explains in detailed steps an algorithm that uses isEqual to count the number of elements in the list that are equal to a certain value; consider the Personalized Project Reference and Written Response 2(c); if multiple lists are included in the Lists section of the Personalized Project Reference, use the first list to determine whether the point is earned; the algorithm can be described in code, pseudocode, as a sequence of steps in English, or as a paragraph in English; the algorithm must describe iterating over all elements of the list, calling isEqual on each list element and maintaining a count of the number of list elements equal to a certain value; the algorithm must correctly determine the number of elements that are equal to a certain value, and some ways this can be determined is by storing the value in a variable, returning it, or displaying it to the user. Do NOT award if a list is not identified in the Lists section of the Personalized Project Reference or the description of the algorithm is not detailed enough for someone else to write the code. (CED p. 191)
评分指南:每一分如何获得

一般评分说明:回答应仅根据所提供的理由来评估;回答必须在每一行中展示所有标准,包括项目符号列表中的标准,才能获得该行的分数。 (CED p. 188)

书面回答 2 有三个 0-1 分的评分行:2(a)、2(b) 和 2(c),共 3 分。 (CED pp. 190-191)

  • 视频(0-1 分):当视频展示程序运行,包括输入、程序功能和输出时得分;评分时只考虑视频;如果视频未展示程序运行(截图或故事板不可接受,也不会得分),则不得分。 (CED p. 189)
  • 程序要求(0-1 分):当程序代码包括一个列表、一个过程、对该过程的调用、选择以及迭代时得分;考虑个性化项目参考(必要时考虑程序代码),如果程序要求未出现在个性化项目参考中,则考虑完整的程序代码文件。如果列表是单元素列表、列表的使用无关或未在程序中使用,或者选择或迭代的使用是微不足道的(即不影响程序结果),则不得分。过程不必有参数即可获得此分;展示选择和迭代的代码段不必出现在同一算法中,也不必包含在过程中。 (CED p. 189)
  • 书面回答 1:程序设计、功能和目的(0-1 分):当书面回答识别程序的预期用户,并描述程序设计满足所识别用户需求的一种方式时得分;考虑书面回答 1 和学生的程序代码;回答必须将程序设计联系到所识别用户的需求。如果对设计的描述不合理、不准确或与程序不一致,则不得分。 (CED p. 189)
  • 书面回答 2(a):算法开发(0-1 分):书面回答识别迭代语句主体将执行的次数,并描述会导致无限循环的条件或错误。(这是 CED 针对其示例 2(a) 提示的评分指南;考试当天的提示可能询问算法的其他方面,因此要练习从多个角度解释你的迭代。)考虑个性化项目参考和书面回答 2(a);如果个性化项目参考的“过程”部分包含多个迭代语句,则使用第一个迭代语句判断是否得分;迭代语句不必包含在过程中。如果所识别的迭代语句主体执行次数与代码不符,则不得分。 (CED p. 191)
  • 书面回答 2(b):错误与测试(0-1 分):当书面回答描述对过程的一项更改会导致运行时错误,并解释为什么该更改会导致运行时错误时得分;考虑个性化项目参考和书面回答 2(b);如果个性化项目参考的“过程”部分第 (i) 部分包含多个过程,则使用第一个过程判断是否得分。如果个性化项目参考的“过程”部分第 (i) 部分未标识过程、回答不适用于个性化项目参考的“过程”部分第 (i) 部分中的过程,或者回答所描述的预期行为不合理、不准确或与程序不一致,则不得分。 (CED p. 191)
  • 书面回答 2(c):数据与过程抽象(0-1 分):当书面回答用详细步骤解释一个使用 isEqual 统计列表中等于某个值的元素数量的算法时得分;考虑个性化项目参考和书面回答 2(c);如果个性化项目参考的“列表”部分包含多个列表,则使用第一个列表判断是否得分;算法可以用代码、伪代码、英语步骤序列或英语段落描述;算法必须描述遍历列表的所有元素、对每个列表元素调用 isEqual,并维护等于某个值的列表元素数量的计数;算法必须正确确定等于某个值的元素数量,确定该数量的一些方式包括将值存储在变量中、返回该值或向用户显示该值。如果个性化项目参考的“列表”部分未标识列表,或者算法描述不够详细,其他人无法据此编写代码,则不得分。 (CED p. 191)
Personalized Project Reference rules
  • Component C: Personalized Project Reference (created independently). To assist in responding to the written response prompts on exam day, submit required portions of your code by capturing and pasting program code segments you developed during the administration of this task. The Personalized Project Reference itself must be completed individually, without collaboration; the code segments used in it can be developed with your partner(s) or on your own as you work on the performance task during class. (CED pp. 197, 200)
  • Screen captures should not be blurry, and text should be at least 10-point font size. Your code segments should not include any comments. These code segments will be made available to you on exam day only if this component is submitted as final in the AP Digital Portfolio by the deadline. (CED p. 200)
  • Procedure: capture and paste two program code segments you developed during the administration of this task that contain a student-developed procedure that implements an algorithm used in your program and a call to that procedure. Built-in or existing procedures and language structures, such as event handlers and main methods, are not considered student-developed. (CED p. 200)
  • Procedure segment i: the first program code segment must be a student-developed procedure that defines the procedure's name and return type (if necessary); contains and uses one or more parameters that have an effect on the functionality of the procedure; and implements an algorithm that includes sequencing, selection, and iteration. (CED p. 200)
  • Procedure segment ii: the second program code segment must show where your student-developed procedure is being called in your program. (CED p. 200)
  • List: capture and paste two program code segments you developed during the administration of this task that contain a list (or other collection type) being used to manage complexity in your program.
  • List segment i: the first program code segment must show how data have been stored in the list.
  • List segment ii: the second program code segment must show the data in the same list being used, such as creating new data from the existing data or accessing multiple elements in the list, as part of fulfilling the program's purpose.
个性化项目参考规则
  • 组件 C:个性化项目参考(独立创建)。为帮助在考试日回答书面回答提示,提交所需代码部分:捕获并粘贴你在完成此任务期间开发的程序代码段。个性化项目参考本身必须由你个人完成,不得协作;其中使用的代码段可以在课堂完成此表现性任务期间与搭档或独自开发。 (CED pp. 197, 200)
  • 屏幕截图不应模糊,文字应至少为 10 磅字号。你的代码段不应包含任何注释。只有在截止日期前将此组件作为最终版本提交到 AP Digital Portfolio,这些代码段才会在考试日提供给你。 (CED p. 200)
  • 过程:捕获并粘贴你在完成此任务期间开发的两个程序代码段,其中包含一个学生开发的过程,该过程实现程序中使用的算法,并包含对该过程的调用。内置或现有过程以及语言结构(例如事件处理程序和 main 方法)不被视为学生开发。 (CED p. 200)
  • 过程代码段 i:第一个程序代码段必须是一个学生开发的过程,它定义过程名称和返回类型(如有必要);包含并使用一个或多个会影响该过程功能的参数;并实现一个包括顺序、选择和迭代的算法。 (CED p. 200)
  • 过程代码段 ii:第二个程序代码段必须展示你的学生开发过程在程序中被调用的位置。 (CED p. 200)
  • 列表:捕获并粘贴你在完成此任务期间开发的两个程序代码段,其中包含用于管理程序复杂性的列表(或其他集合类型)。
  • 列表代码段 i:第一个程序代码段必须显示数据如何存储在列表中。
  • 列表代码段 ii:第二个程序代码段必须显示同一列表中的数据如何被使用,例如从现有数据创建新数据或访问列表中的多个元素,作为实现程序目的的一部分。
Plan your project checklist
  • Collaborate only on the development of the program code; complete the video and Personalized Project Reference individually, without collaboration with your partner(s) or anyone else. (CED p. 197)
  • Choose an expected user; make sure Written Response 1 can identify the expected user and relate the program design to that user's needs. (CED p. 189)
  • Include input instructions from the user (including user actions that trigger events), a device, an online data stream, or a file. (CED p. 198)
  • Use a list (or other collection type) that stores data, is actually used, manages complexity, helps fulfill the program's purpose, is not a one-element list, and is used in a relevant way. (CED pp. 189, 198)
  • Define a student-developed procedure with its name, return type (if necessary), and one or more parameters; put an algorithm with sequencing, selection, and iteration in the procedure body; call the procedure. (CED p. 198)
  • Make the selection and iteration non-trivial (they must affect the outcome of the program). (CED p. 189)
  • Include output instructions (tactile, audible, visual, or textual) based on input and program functionality. (CED p. 198)
  • Submit final program code as one PDF file containing all program code (including comments), with comments or acknowledgments for code written by someone else. (CED p. 198)
  • Prepare the Personalized Project Reference: two procedure code segments (definition and call) and two list code segments (data stored and same list used); use clear screen captures with text at least 10-point font size; do not include comments. (CED pp. 200–201)
  • Record the video so it shows input, at least one aspect of functionality, and output; do not include distinguishing information about yourself or voice narration; use an allowed format, no more than 1 minute, no more than 30 MB. (CED p. 199)
  • Submit the Personalized Project Reference as final in the AP Digital Portfolio by the deadline so the code segments are available on exam day. (CED p. 200)
规划你的项目清单
  • 仅在程序代码开发中协作;视频和个性化项目参考必须由你个人完成,不得与搭档或任何其他人协作。 (CED p. 197)
  • 选择预期用户;确保书面回答 1 能识别预期用户,并将程序设计联系到该用户的需求。 (CED p. 189)
  • 包含来自用户(包括触发事件的用户操作)、设备、在线数据流或文件的输入指令。 (CED p. 198)
  • 使用一个列表(或其他集合类型),它存储数据、确实被使用、管理复杂性、帮助实现程序目的、不是单元素列表,并以相关的方式使用。 (CED pp. 189, 198)
  • 定义一个学生开发的过程,包括其名称、返回类型(如有必要)以及一个或多个参数;在过程主体中放入包括顺序、选择和迭代的算法;调用该过程。 (CED p. 198)
  • 使选择和迭代非微不足道(它们必须影响程序结果)。 (CED p. 189)
  • 包含基于输入和程序功能的输出指令(触觉、听觉、视觉或文本)。 (CED p. 198)
  • 将最终程序代码作为一个 PDF 文件提交,包含全部程序代码(包括注释),并对他人编写的代码添加注释或致谢。 (CED p. 198)
  • 准备个性化项目参考:两个过程代码段(定义和调用)和两个列表代码段(数据存储和同一列表被使用);使用清晰屏幕截图,文字至少 10 磅字号;不要包含注释。 (CED pp. 200–201)
  • 录制视频,使其展示输入、至少一个功能方面和输出;不要包含可识别你身份的信息或语音旁白;使用允许的格式,不超过 1 分钟,不超过 30 MB。 (CED p. 199)
  • 在截止日期前将个性化项目参考作为最终版本提交到 AP Digital Portfolio,以便代码段在考试日可用。 (CED p. 200)

Unit 1 MCQ Patterns That Show Up Every Year

单元 1 每年都会出现的选择题套路

Creative Development accounts for 10–13% of the multiple-choice exam. Questions may ask you to evaluate collaboration, distinguish program purpose from behavior, or choose development and testing practices.

创造性开发(Creative Development)约占选择题的 10%–13%。题目可能要求你评估协作、区分程序目的与行为,或选择合适的开发和测试方法。

Pattern 1: Value diverse perspectives When a team is designing for users, look for consultation and feedback from people with different perspectives. These can reveal needs and reduce bias, though they do not guarantee its elimination. (See Topic 1.1.)
套路 1:重视多元视角 当团队为用户设计程序时,优先考虑向不同视角的人咨询并收集反馈。这有助于发现需求、减少偏见,但不能保证彻底消除偏见。(参见主题 1.1。)
Pattern 2: Separate purpose, input, and output Identify the problem or interest as the purpose, data sent to the program as input, and data sent to a device as output. An event can trigger statements and supply input. (See Topic 1.2.)
套路 2:区分目的、输入和输出 将程序要解决的问题或满足的兴趣看作目的;发送给程序的数据是输入,程序发送到设备的数据是输出。事件(event)可以触发语句并提供输入。(参见主题 1.2。)
Pattern 3: Distinguish development processes Revising based on feedback or testing is iterative; building and checking smaller pieces before adding them to the whole is incremental. A process can use both approaches. (See Topic 1.3.)
套路 3:区分开发过程 根据反馈或测试结果反复修改属于迭代式开发(iterative development);先构建并检查小部分,再将其加入整体,属于增量式开发(incremental development)。一个过程可以同时采用两种方法。(参见主题 1.3。)
Pattern 4: Document and credit code Comments explain code to people and do not change how it runs. Documentation can also credit collaboratively developed or external code by naming its origin or author. (See Topic 1.3.)
套路 4:编写文档并注明代码来源 注释(comment)供人阅读,不会改变程序运行方式。文档(documentation)还可以通过注明来源或作者,确认协作编写或外部代码的贡献。(参见主题 1.3。)
Pattern 5: Test boundaries and trace errors Use requirements to choose inputs at and just beyond allowed extremes, then compare actual and expected behavior. Trace the program to locate logic errors; distinguish them from syntax and run-time errors. (See Topic 1.4.)
套路 5:测试边界并追踪错误 根据需求选择位于允许范围边界及刚好超出边界的输入,再比较实际行为与预期行为。通过手动追踪(hand tracing)定位逻辑错误,并将其与语法错误和运行时错误区分开。(参见主题 1.4。)

Flashcards, Click to Flip

闪卡(点击翻面)

What makes something a computing innovation?什么使一项创新成为计算创新(computing innovation)?
A program is an integral part of its function. It can be physical, software, or a computing concept.程序是其功能不可或缺的一部分。它可以是实体、软件或计算概念。
How can diverse collaboration improve a computing innovation?多元协作如何改进计算创新(computing innovation)?
Different talents and user perspectives can reveal needs and help reduce bias.不同的才能和用户视角有助于发现需求并减少偏见。
What practices support effective collaboration?哪些做法有助于有效协作?
Communication, consensus building, conflict resolution, negotiation, and shared tools or pair programming.沟通、达成共识、解决冲突、协商,以及使用共享工具或结对编程(pair programming)。
How do a program's purpose and behavior differ?程序的目的(purpose)与行为(behavior)有何区别?
Purpose is the problem or interest it addresses; behavior is how it functions during execution.目的是程序要解决的问题或满足的兴趣;行为是程序执行时如何运行。
What are program inputs and outputs?什么是程序的输入(input)和输出(output)?
Inputs are data sent to a computer for processing; outputs are data sent from a program to a device.输入是发送给计算机供程序处理的数据;输出是程序发送到设备的数据。
What is an event in event-driven programming?在事件驱动编程(event-driven programming)中,什么是事件(event)?
Something associated with an action that supplies input data and can trigger program statements, such as a key press or mouse click.与某个动作相关联、向程序提供输入数据并可触发程序语句执行的发生项,例如按键或鼠标点击。
How do iterative and incremental development differ?迭代式开发(iterative development)与增量式开发(incremental development)有何区别?
Iterative development revises using feedback, testing, or reflection; incremental development builds and checks smaller pieces before combining them.迭代式开发利用反馈、测试或反思进行修改;增量式开发先构建并检查小部分,再将其组合。
What are program requirements and a specification?什么是程序需求(requirements)和规格说明(specification)?
Requirements describe how a program should function and may describe user interactions; a specification defines those requirements.需求描述程序应如何运行,也可能描述用户交互;规格说明定义这些需求。
Why document a program and acknowledge borrowed code?为什么要编写程序文档(documentation)并注明借用代码的来源?
Documentation supports development and maintenance; credit identifies the origin or original author of code from others.文档有助于开发和维护;注明来源可以表明他人代码的出处或原作者。
How do logic, syntax, and run-time errors differ?逻辑错误(logic error)、语法错误(syntax error)和运行时错误(run-time error)有何区别?
A logic error causes incorrect behavior; a syntax error breaks language rules; a run-time error occurs during execution.逻辑错误导致行为不正确;语法错误违反语言规则;运行时错误在程序执行期间发生。
What is an overflow error?什么是溢出错误(overflow error)?
An error caused by attempting to handle a number outside the defined range of values.尝试处理超出定义数值范围的数字时发生的错误。
How should test inputs be chosen?应如何选择测试输入(test inputs)?
Use requirements to select inputs with expected outcomes, including values at and just beyond the minimum and maximum.根据需求选择具有预期结果的输入,包括最小值、最大值及刚好超出边界的值。

Unit 1, Practice Quiz

单元 1:练习小测

1. A team is building a navigation app for people with different mobility needs. Which action is most likely to improve the app and help reduce bias?1. 团队正在为行动需求不同的人开发导航应用。哪种做法最有可能改进应用并帮助减少偏见?
Use only the developers' preferences 只采用开发者的偏好
Avoid user feedback 避免用户反馈
Let one developer make every decision 让一名开发者做所有决定
Consult diverse potential users 咨询不同的潜在用户
Correct! Diverse user perspectives can reveal needs that the developers might otherwise miss.正确!不同用户的视角可以揭示开发者可能忽略的需求。
Collaboration with diverse users provides information that a team relying only on its own assumptions may miss.与不同用户协作能提供信息,帮助团队发现仅依靠自身假设可能忽略的问题。
2. A music app receives a user's song choice and displays a recommendation. Which is an input to the program?2. 音乐应用接收用户选择的歌曲并显示推荐结果。哪一项是程序的输入(input)?
The displayed recommendation 显示的推荐结果
The purpose of recommending music 推荐音乐的目的
The app's written documentation 应用的书面文档
The user's song choice 用户选择的歌曲
Correct! The song choice is data sent to the program for processing.正确!歌曲选择是发送给程序进行处理的数据。
Input is data supplied to the program. The displayed recommendation is output, while purpose and documentation are neither the supplied data nor the displayed result.输入是提供给程序的数据。显示的推荐结果是输出;目的和文档既不是所提供的数据,也不是显示的结果。
3. A team builds and checks a login feature, then adds and checks a search feature. Which development approach does this illustrate?3. 团队先构建并检查登录功能,再加入并检查搜索功能。这体现了哪种开发方法?
Only collecting user input 只收集用户输入
Ignoring testing 忽略测试
Incremental development 增量式开发
Writing documentation only 只编写文档
Correct! The team builds and checks smaller pieces before adding them to the whole.正确!团队先构建并检查小部分,再将其加入整体。
Incremental development divides a problem into pieces and checks each piece as it is added. The scenario describes building features, not just collecting input or writing documentation.增量式开发将问题分成小部分,并在加入整体时检查各部分。题目描述的是构建功能,而不只是收集输入或编写文档。
4. A programmer uses a code segment written by someone else. What should the program documentation include?4. 程序员使用了他人编写的代码段。程序文档(documentation)应包含什么?
A claim that the programmer wrote the segment 声称该程序员编写了代码段
The code's origin or original author's name 代码的来源或原作者姓名
Only the date the program was tested 仅记录程序测试日期
A guarantee that the code has no errors 保证代码没有错误
Correct! Documentation can acknowledge the segment by identifying its origin or original author.正确!文档可以通过注明代码段的来源或原作者来确认其贡献。
Code written by another source should be acknowledged. A test date or a claim about correctness does not identify who supplied it.应注明他人编写的代码的来源。测试日期或对正确性的声明不能说明代码由谁提供。
5. The program is intended to count from 1 through 5 and display the count. What value does this version actually display?5. 该程序原本要统计从 1 到 5 的整数个数并显示结果。这个版本实际显示什么值?
count ← 0
REPEAT 4 TIMES {
  count ← count + 1
}
DISPLAY(count)
5
6
4
7
Correct! The loop increments count four times, so it displays 4 rather than the intended 5.正确!循环将 count 加 1 共四次,因此显示 4,而不是预期的 5。
Start at 0 and add 1 once per repetition. Four repetitions produce 4; the incorrect repetition count is a logic error.从 0 开始,每次重复加 1。重复四次得到 4;重复次数不正确属于逻辑错误(logic error)。
6. A program must accept whole-number ages from 1 through 120, inclusive, and reject values outside that range. Which set best tests both boundaries and values just outside them?6. 程序必须接受 1 到 120(含两端)的整数年龄,并拒绝范围外的值。哪组输入最适合测试两个边界及刚好超出边界的值?
0, 1, 120, 121
2, 60, 119
1, 60, 120
0, 60, 121
Correct! The set includes both valid boundary values and the whole numbers immediately outside them.正确!这组输入包含两个有效边界值,以及刚好在边界外的整数。
Test both 1 and 120, then test 0 and 121 to check rejection just outside the allowed range.应测试 1 和 120 这两个边界值,再测试 0 和 121,检查程序是否拒绝刚好超出允许范围的值。

AP-Style Practice Problems

AP 风格练习题

Try the 15-question practice set to review Creative Development scenarios, program behavior, and testing.

完成 15 道题的练习,复习创造性开发场景、程序行为和测试。

Practice Problems →练习题 →

鼎睿学苑 · Dingrui Scholars

AP Computer Science Principles, Unit 1: Creative Development · 2026 Edition

AP 计算机科学原理,单元 1:创造性开发 · 2026 版