AP Computer Science Principles Creative Development — Worked Answer Explanations

Unit 1 · 12 questions explained

Below is a complete answer key for our AP Computer Science Principles Creative Development practice questions. For each question you'll find the correct choice, a full written explanation of how to get there, and — for every wrong answer — a short note on exactly why it's tempting and where it goes wrong. Reading these straight through is one of the fastest ways to find the gaps in a unit before exam day.

Prefer to test yourself first? Take the timed Creative Development practice test and come back here to review, or head back to the Creative Development unit overview.

In-content ad
  1. Question 1 · Easy

    Which of the following BEST describes the purpose of documentation in a program?

    • A
      To make the program run faster by reducing the number of lines of code.
      Why not A: Documentation adds explanatory text and does not reduce executable code or affect runtime speed.
    • B
      To explain the purpose, behavior, and design of the code so that others (and the author later) can understand it.Correct
    • C
      To prevent the program from producing errors at runtime.
      Why not C: Documentation is descriptive text for humans; it has no effect on runtime errors.
    • D
      To replace the need for testing by describing what the program is supposed to do.
      Why not D: Documentation does not substitute for testing; a program must still be tested to verify correctness.
    Explanation

    Documentation — including comments, README files, and inline notes — describes what a program does and why design decisions were made. It helps developers maintain, debug, and extend code. Documentation improves human understanding but does not affect execution speed or replace testing.

    Key takeaway

    Documentation explains code intent and design for human readers; it neither speeds up execution nor replaces testing.

  2. Question 2 · Easy

    A student is working on a program that draws shapes on screen. After writing the first version, she notices the circles look slightly off-center. She adjusts a coordinate value, tests again, and the circles look correct. This process BEST illustrates which program development practice?

    • A
      Abstraction
      Why not A: Abstraction involves hiding complexity behind simpler interfaces, not adjusting and re-testing a specific value.
    • B
      IterationCorrect
    • C
      Documentation
      Why not C: Documentation describes the program; it does not describe the act of refining and retesting code.
    • D
      Compilation
      Why not D: Compilation translates source code to machine code; it is not the process of adjusting and re-testing behavior.
    Explanation

    Iterative development means repeatedly refining a program — write, test, observe results, adjust, test again. The student's cycle of testing → noticing a flaw → adjusting → retesting is a textbook example of iteration. Abstraction, documentation, and compilation are different concepts.

    Key takeaway

    Iterative development is the cycle of write → test → refine → repeat, gradually improving the program.

  3. Question 3 · Easy

    Which of the following BEST describes a benefit of collaborating with others during program development?

    • A
      Collaboration guarantees the program will be completed faster than working alone.
      Why not A: Collaboration does not guarantee faster completion; communication overhead can slow a team down in some cases.
    • B
      Collaboration eliminates the need for testing because multiple people review the code.
      Why not B: Multiple reviewers reduce some errors but do not replace systematic testing.
    • C
      Collaboration allows different perspectives and areas of expertise to be incorporated, improving the program.Correct
    • D
      Collaboration requires that all team members write identical code to avoid conflicts.
      Why not D: Collaboration does not require identical code; different team members typically work on different parts.
    Explanation

    Collaboration brings together diverse skills, experiences, and viewpoints. One collaborator may catch bugs another missed; another may contribute domain knowledge that improves the design. This diversity of perspective is the primary benefit cited in the AP CSP curriculum.

    Key takeaway

    Collaboration improves programs by combining diverse skills and perspectives that no single developer may possess.

  4. Question 4 · Easy

    A group of students is designing an app to track school events. They gather requirements by asking students and teachers what features they want before writing any code. This activity is BEST described as which phase of the design thinking process?

    • A
      Prototyping
      Why not A: Prototyping involves building a rough working model; it happens after requirements are understood.
    • B
      Testing
      Why not B: Testing verifies whether a built product works correctly; it does not describe initial requirements gathering.
    • C
      Empathizing / defining the problemCorrect
    • D
      Deploying
      Why not D: Deploying means releasing the finished product to users; it follows development and testing.
    Explanation

    Design thinking begins with empathizing — understanding users' needs and defining the problem from their perspective. Interviewing students and teachers to learn what features they want is exactly this phase. Prototyping, testing, and deploying come later in the process.

    Key takeaway

    The empathize/define phase of design thinking focuses on understanding user needs before any building begins.

  5. Question 5 · Easy

    Which of the following is an example of DEBUGGING a program?

    • A
      Writing comments to explain what each section of code does.
      Why not A: Writing comments is documentation, not debugging.
    • B
      Running a program with sample inputs and checking whether the outputs match expected results.
      Why not B: This describes testing. Debugging begins after a bug is found — it is the process of locating and fixing the cause.
    • C
      Identifying that a sorting procedure returns results in the wrong order, locating the comparison that is reversed, and fixing it.Correct
    • D
      Planning the structure of a program before writing any code.
      Why not D: Planning the structure is program design, which occurs before coding and is separate from debugging.
    Explanation

    Debugging is the process of finding the cause of a known problem in a program and correcting it. Option C — noticing incorrect output (wrong order), tracing it to a reversed comparison, and fixing the comparison — is a complete debugging cycle. Testing finds problems; debugging finds and fixes their causes.

    Key takeaway

    Debugging means locating the root cause of a known error in code and correcting it, distinct from testing which reveals errors.

  6. Question 6 · Easy

    A developer releases version 1.0 of an app, collects user feedback revealing that the search feature is confusing, and redesigns the search interface for version 2.0. This cycle BEST reflects which principle of program development?

    • A
      Sequential development — completing each phase fully before moving to the next.
      Why not A: Sequential (waterfall) development does not loop back; feedback-driven redesign is the opposite of a one-pass sequential model.
    • B
      Iterative development — using feedback from each version to improve the next.Correct
    • C
      Parallel development — having multiple teams write independent versions simultaneously.
      Why not C: Parallel development describes splitting work across teams, not revision based on user feedback.
    • D
      Abstraction — hiding the complexity of the search algorithm from users.
      Why not D: Abstraction is a design technique for managing complexity; it does not describe the version-feedback-redesign cycle.
    Explanation

    Iterative development embraces releasing early, gathering real-world feedback, and incorporating that feedback into successive versions. Releasing v1.0, observing users struggling with search, and redesigning it for v2.0 is a canonical iteration. Sequential development would not revisit earlier decisions based on feedback.

    Key takeaway

    Iterative development deliberately uses feedback from each release to drive improvements in the next version.

  7. Question 7 · Easy

    Which of the following is the BEST description of a program specification?

    • A
      The executable code that makes a program run.
      Why not A: Executable code is the implementation; a specification describes what the program should do, not how the code is written.
    • B
      A document that describes what a program should do, its inputs, outputs, and constraints.Correct
    • C
      A visual representation of how data flows through a computer's hardware.
      Why not C: That describes a data-flow diagram or hardware architecture diagram, not a program specification.
    • D
      A list of all the bugs found during testing.
      Why not D: A bug list is a testing artifact; a specification defines requirements before or during development.
    Explanation

    A specification (or spec) defines what a program is supposed to do: its purpose, required inputs, expected outputs, performance constraints, and other requirements. It guides developers and testers. It is not executable code, not a hardware diagram, and not a bug list.

    Key takeaway

    A program specification defines requirements — inputs, outputs, and constraints — guiding development and testing.

  8. Question 8 · Easy

    A team uses a shared online document so all members can see the current project plan and leave comments. Which aspect of collaborative development does this MOST directly support?

    • A
      Abstraction — hiding implementation details from team members who do not need them.
      Why not A: Abstraction is a programming concept, not a description of shared-document communication.
    • B
      Communication and transparency — keeping all collaborators informed and allowing asynchronous feedback.Correct
    • C
      Compilation — converting the shared plan into machine-readable instructions.
      Why not C: Compilation converts source code to machine code; it has nothing to do with shared planning documents.
    • D
      Testing — verifying that each team member's code produces correct output.
      Why not D: Testing involves running code with inputs; a shared planning document is a communication tool, not a testing tool.
    Explanation

    Shared documents that show the current plan and allow comments support transparent communication among collaborators. Team members can stay aligned on goals, raise concerns asynchronously, and coordinate without meeting in real time — all key aspects of effective collaboration.

    Key takeaway

    Shared planning documents support transparent, asynchronous communication that keeps all collaborators informed and aligned.

  9. Question 9 · Medium

    Consider the following program development scenario:

    1. A student writes pseudocode describing the algorithm.
    2. She tests the pseudocode logic on paper with sample inputs.
    3. She codes the algorithm in a programming language.
    4. She runs the code and discovers it does not handle the case where the input list is empty.
    5. She revises the code to handle empty input and tests again.

    At step 4, the student is performing which activity?

    • A
      Program design
      Why not A: Program design (steps 1-2) precedes coding; step 4 occurs after the code already exists and is being run.
    • B
      Documentation
      Why not B: Documentation involves writing explanatory notes; discovering a bug by running the program is testing, not documentation.
    • C
      TestingCorrect
    • D
      Abstraction
      Why not D: Abstraction is a design technique for managing complexity; running code to observe failure is testing.
    Explanation

    At step 4 the student runs her program and observes that it fails for empty input — she is testing. Testing means executing the program with specific inputs to see if it behaves correctly. Step 5 (revising the code to fix the problem) is debugging.

    Key takeaway

    Running code and observing whether it behaves correctly is testing; fixing a discovered problem is debugging.

  10. Question 10 · Medium

    A program that reads a list of numbers and finds the maximum value contains the following bug: when all numbers are negative, it always returns 0. A developer adds a test case with the input [-5, -1, -3] expecting the output -1 but gets 0. After investigation, she realizes the maximum variable was initialized to 0 instead of the first list element.

    Which of the following describes the COMPLETE process used to find and fix this bug?

    • A
      Testing only — creating a test case that exposed the incorrect output.
      Why not A: Testing revealed the symptom (wrong output), but identifying the initialization error and fixing it is debugging, which is a separate step.
    • B
      Testing to reveal the bug, then debugging to locate and fix the initialization error.Correct
    • C
      Debugging only — investigating the code until the initialization error was found.
      Why not C: Debugging alone does not cover the test case creation that first exposed the wrong output; testing is also part of the process.
    • D
      Abstraction — hiding the initialization detail behind a helper method.
      Why not D: Abstraction is a design technique; it does not describe the process of discovering and correcting a specific initialization bug.
    Explanation

    The scenario has two distinct phases: (1) testing — writing a specific test case that reveals the wrong output, and (2) debugging — tracing the wrong output back to the faulty initialization and correcting it. Both phases together constitute finding and fixing a bug. Testing alone just reveals a symptom; debugging alone doesn't include the deliberate test design.

    Key takeaway

    Finding and fixing a bug requires both testing (to expose the symptom) and debugging (to locate and fix the root cause).

  11. Question 11 · Hard

    A student is developing an app to help users log daily exercise. During testing, a user reports: "When I enter 0 minutes of exercise, the app crashes." The student had not considered zero as a valid input.

    This situation illustrates which challenge in program development?

    • A
      Compilation errors — the code cannot be translated to machine instructions.
      Why not A: Compilation errors prevent the program from building; this app crashes at runtime with specific input, which is a logic/runtime error, not a compilation error.
    • B
      Undecidable problems — it is theoretically impossible to determine whether any input will cause a crash.
      Why not B: The halting problem is undecidable in general, but this is not that scenario — the crash has a specific, findable cause with specific input.
    • C
      Incomplete specification — the original program design did not account for all valid inputs, leading to unexpected behavior.Correct
    • D
      Hardware failure — the device cannot process a zero value correctly.
      Why not D: Hardware cannot distinguish zero from other integers; the fault is in the program logic, not the hardware.
    Explanation

    The developer's specification (mental or written) assumed users would enter positive values, leaving zero unhandled. This is an incomplete specification — the requirements did not fully enumerate the valid input domain. It is a logic/runtime error, not a compilation error, an undecidability issue, or a hardware fault. Thorough specifications enumerate edge cases like 0, empty strings, and maximum values.

    Key takeaway

    Crashes on unexpected but valid inputs often signal an incomplete specification that did not account for edge cases.

  12. Question 12 · Hard

    Two students are collaborating on a program. Student A writes the data-storage module and Student B writes the display module. They agree that the display module will call getData() to retrieve values, regardless of how Student A internally stores the data.

    This agreement BEST demonstrates which concept?

    • A
      Iteration — repeatedly refining the interface until both students agree.
      Why not A: While they may refine the interface iteratively, the key concept here is that one module's internals are hidden from the other — that is abstraction via a defined interface.
    • B
      Abstraction via a defined interface — the display module interacts with stored data through getData() without needing to know the internal implementation.Correct
    • C
      Debugging — finding and fixing errors in the communication between modules.
      Why not C: This describes agreeing on an interface before writing code, not finding and fixing errors.
    • D
      Sequential development — Student A must finish completely before Student B can begin.
      Why not D: With a defined interface, both students can work in parallel — Student B codes against the getData() contract while Student A implements the storage. They do not have to work sequentially.
    Explanation

    By agreeing that the display module calls getData() and nothing else, the students create an abstraction barrier. The display module only knows the interface (what getData() returns), not the implementation (how data is stored internally). This allows parallel development and easy replacement of either module later. This is abstraction — specifically, procedural abstraction via a defined interface — applied in a collaborative context.

    Key takeaway

    Defining an interface (e.g., getData()) creates an abstraction barrier that lets collaborators work independently and swap implementations later.