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.
- Question 1 · Easy
Which of the following BEST describes the purpose of documentation in a program?
- ATo 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.
- BTo explain the purpose, behavior, and design of the code so that others (and the author later) can understand it.Correct
- CTo prevent the program from producing errors at runtime.Why not C: Documentation is descriptive text for humans; it has no effect on runtime errors.
- DTo 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.
ExplanationDocumentation — 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 takeawayDocumentation explains code intent and design for human readers; it neither speeds up execution nor replaces testing.
- A
- 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?
- AAbstractionWhy not A: Abstraction involves hiding complexity behind simpler interfaces, not adjusting and re-testing a specific value.
- BIterationCorrect
- CDocumentationWhy not C: Documentation describes the program; it does not describe the act of refining and retesting code.
- DCompilationWhy not D: Compilation translates source code to machine code; it is not the process of adjusting and re-testing behavior.
ExplanationIterative 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 takeawayIterative development is the cycle of write → test → refine → repeat, gradually improving the program.
- A
- Question 3 · Easy
Which of the following BEST describes a benefit of collaborating with others during program development?
- ACollaboration 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.
- BCollaboration 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.
- CCollaboration allows different perspectives and areas of expertise to be incorporated, improving the program.Correct
- DCollaboration 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.
ExplanationCollaboration 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 takeawayCollaboration improves programs by combining diverse skills and perspectives that no single developer may possess.
- A
- 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?
- APrototypingWhy not A: Prototyping involves building a rough working model; it happens after requirements are understood.
- BTestingWhy not B: Testing verifies whether a built product works correctly; it does not describe initial requirements gathering.
- CEmpathizing / defining the problemCorrect
- DDeployingWhy not D: Deploying means releasing the finished product to users; it follows development and testing.
ExplanationDesign 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 takeawayThe empathize/define phase of design thinking focuses on understanding user needs before any building begins.
- A
- Question 5 · Easy
Which of the following is an example of DEBUGGING a program?
- AWriting comments to explain what each section of code does.Why not A: Writing comments is documentation, not debugging.
- BRunning 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.
- CIdentifying that a sorting procedure returns results in the wrong order, locating the comparison that is reversed, and fixing it.Correct
- DPlanning 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.
ExplanationDebugging 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 takeawayDebugging means locating the root cause of a known error in code and correcting it, distinct from testing which reveals errors.
- A
- 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?
- ASequential 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.
- BIterative development — using feedback from each version to improve the next.Correct
- CParallel development — having multiple teams write independent versions simultaneously.Why not C: Parallel development describes splitting work across teams, not revision based on user feedback.
- DAbstraction — 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.
ExplanationIterative 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 takeawayIterative development deliberately uses feedback from each release to drive improvements in the next version.
- A
- Question 7 · Easy
Which of the following is the BEST description of a program specification?
- AThe 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.
- BA document that describes what a program should do, its inputs, outputs, and constraints.Correct
- CA 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.
- DA 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.
ExplanationA 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 takeawayA program specification defines requirements — inputs, outputs, and constraints — guiding development and testing.
- A
- 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?
- AAbstraction — 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.
- BCommunication and transparency — keeping all collaborators informed and allowing asynchronous feedback.Correct
- CCompilation — 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.
- DTesting — 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.
ExplanationShared 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 takeawayShared planning documents support transparent, asynchronous communication that keeps all collaborators informed and aligned.
- A
- Question 9 · Medium
Consider the following program development scenario:
- A student writes pseudocode describing the algorithm.
- She tests the pseudocode logic on paper with sample inputs.
- She codes the algorithm in a programming language.
- She runs the code and discovers it does not handle the case where the input list is empty.
- She revises the code to handle empty input and tests again.
At step 4, the student is performing which activity?
- AProgram designWhy not A: Program design (steps 1-2) precedes coding; step 4 occurs after the code already exists and is being run.
- BDocumentationWhy not B: Documentation involves writing explanatory notes; discovering a bug by running the program is testing, not documentation.
- CTestingCorrect
- DAbstractionWhy not D: Abstraction is a design technique for managing complexity; running code to observe failure is testing.
ExplanationAt 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 takeawayRunning code and observing whether it behaves correctly is testing; fixing a discovered problem is debugging.
- 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-1but gets0. 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?
- ATesting 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.
- BTesting to reveal the bug, then debugging to locate and fix the initialization error.Correct
- CDebugging 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.
- DAbstraction — 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.
ExplanationThe 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 takeawayFinding and fixing a bug requires both testing (to expose the symptom) and debugging (to locate and fix the root cause).
- A
- 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?
- ACompilation 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.
- BUndecidable 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.
- CIncomplete specification — the original program design did not account for all valid inputs, leading to unexpected behavior.Correct
- DHardware 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.
ExplanationThe 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 takeawayCrashes on unexpected but valid inputs often signal an incomplete specification that did not account for edge cases.
- A
- 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?
- AIteration — 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.
- BAbstraction via a defined interface — the display module interacts with stored data through
getData()without needing to know the internal implementation.Correct - CDebugging — 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.
- DSequential 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.
ExplanationBy agreeing that the display module calls
getData()and nothing else, the students create an abstraction barrier. The display module only knows the interface (whatgetData()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 takeawayDefining an interface (e.g., getData()) creates an abstraction barrier that lets collaborators work independently and swap implementations later.
- A