Early & unofficial solutions · 2026
Early Solutions to the 2026 AP Computer Science Principles FRQs | Step by Step
A complete, student-friendly walkthrough of the uploaded 2026 written-response guide, including the sample Personalized Project Reference, exact pseudocode, loop traces, model responses, adaptation templates, and final review tools.
1. How to Use This Guide
The 2026 written-response section asks you to explain your own program rather than solve one fixed programming problem. A strong response must connect every claim to a named code segment, variable, parameter, list, condition, or procedure call from the PPR.
What each prompt is testing
| Prompt | What the response must do | Code evidence to name |
|---|---|---|
| Question 1 | Describe one useful piece of documentation and explain how it helps another programmer understand a particular code segment. | The documented procedure, loop, event handler, variable, input, output, or algorithm. |
| Question 2A | Identify what controls the first iteration statement and give exact values that make the loop stop. | The exact loop condition, loop-control variable(s), parameter(s), and stopping value(s). |
| Question 2B | Give an accepted procedure call that exposes incorrect behavior, then trace the cause. If no such call exists, justify why. | Procedure name, specific argument(s), expected behavior, actual behavior, and faulty or protective logic. |
| Question 2C | Explain how a list is a data abstraction that manages complexity, then describe a no-list rewrite or explain why it is not possible. | List name, what its elements represent, the list-processing code, and repeated variables or statements otherwise required. |
Recommended workflow
- Read the sample PPR in the next section so all four worked responses refer to one coherent program.
- Follow the step-by-step reasoning, not only the model-answer boxes.
- Use the adaptation templates to replace the sample identifiers with identifiers from your own PPR.
- Before submitting, verify that every variable name, value, and procedure call actually appears in or follows from your code.
scoreList, scoreSummary, index, and count are correct only for the illustrative project in this guide. On the exam, use the exact capitalization and spelling shown in your own PPR.This page is an independent study aid based on the uploaded PDF. It is not an official College Board scoring guide.
2. Illustrative Personalized Project Reference
The worked solution uses a small Study Score Analyzer. The program stores quiz scores, calculates averages, and classifies performance. The code is written in AP-style pseudocode with one-based list indexing.
List section — part (i): list creation
scoreList <- [88, 94, 76, 100, 91]List section — part (ii): list use
total <- 0
FOR EACH score IN scoreList
{
total <- total + score
}
overallAverage <- total / LENGTH(scoreList)
DISPLAY(overallAverage)Procedure section — part (i): student-developed procedure
PROCEDURE scoreSummary(count)
{
total <- 0
index <- 1
REPEAT UNTIL (index > count)
{
total <- total + scoreList[index]
index <- index + 1
}
average <- total / count
IF (average >= 90)
{
RETURN "Excellent"
}
ELSE
{
RETURN "Keep practicing"
}
}Procedure section — part (ii): procedure call
message <- scoreSummary(3)
DISPLAY(message)scoreSummary. Question 2A analyzes the REPEAT UNTIL loop. Question 2B tests scoreSummary with a count larger than the list. Question 2C explains the scoreList abstraction and rewrites the overall-average code without a list.3. Question 1 — Program Documentation
Prompt task: Describe one appropriate piece of documentation and explain how another programmer could use it to understand a particular code segment.
Choose a specific code segment
Use the procedure scoreSummary because it has a parameter, a loop, a calculation, and a selection statement. Naming a specific segment prevents the explanation from becoming vague.
Write documentation that states purpose and contract
A useful comment block should tell the reader what the procedure does, what the parameter means, what values are intended, what is returned, and any important data dependency.
Appropriate documentation to place immediately above the procedure
/*
Procedure: scoreSummary(count)
Purpose: Classifies the average of the first count values in scoreList.
Parameter: count is the number of scores to include.
Intended range: 1 through LENGTH(scoreList).
Returns: "Excellent" when the average is at least 90;
otherwise returns "Keep practicing".
*/Explain how another programmer uses the documentation
The programmer can determine the meaning of count before calling the procedure, avoid values outside the list bounds, predict the return type and possible return values, and understand that the procedure depends on scoreList.
Why this response addresses the prompt
| Required element | Where the model response supplies it |
|---|---|
| One piece of documentation | A structured comment block placed above scoreSummary. |
| A particular code segment | The response explicitly names the scoreSummary procedure. |
| How it improves understanding | It explains purpose, parameter meaning, intended values, returned result, and list dependency. |
Exam-ready response for Question 1
One appropriate piece of documentation is a comment block immediately above the scoreSummary procedure. The comment states that count is the number of values from scoreList to include, that the intended range is from 1 through LENGTH(scoreList), and that the procedure returns either “Excellent” or “Keep practicing” based on the calculated average. Another programmer could use this documentation to choose a valid argument, understand the purpose of the loop and calculation, and know what result the procedure will return without having to infer every detail from the code.
4. Question 2A — When the First Iteration Stops
The first iteration statement in the sample Procedure section is REPEAT UNTIL (index > count). The response must identify every variable that determines termination, give specific stopping values, and explain why the loop ends.
Copy the loop condition exactly
The Boolean condition is index > count. Both index and count determine whether that expression is true, even though count is not changed inside the loop.
Use a concrete procedure call
For scoreSummary(3), count has the value 3. The variable index begins at 1 and increases by 1 after each score is processed.
Trace until the condition changes
After the third iteration, index becomes 4. At the next condition check, 4 > 3 is true, so the REPEAT UNTIL statement stops.
Trace for scoreSummary(3)
| Iteration | index at start | Score added | total after addition | index after update / condition |
|---|---|---|---|---|
| 1 | 1 | scoreList[1] = 88 | 88 | 2; 2 > 3 is false |
| 2 | 2 | scoreList[2] = 94 | 182 | 3; 3 > 3 is false |
| 3 | 3 | scoreList[3] = 76 | 258 | 4; 4 > 3 is true — stop |
After the loop, average is 258 / 3 = 86, so the selection returns “Keep practicing.” The returned message is not required for the termination answer, but tracing it confirms that the loop processed exactly three elements.
Exam-ready response for Question 2A
The variables index and count determine when the first iteration statement stops because the loop condition is index > count. For the call scoreSummary(3), count equals 3 and index starts at 1. The loop increases index by 1 each time. After the third iteration, index becomes 4, so the condition 4 > 3 is true and the REPEAT UNTIL statement stops iterating.
5. Adapting the Answer to Other Loop Types
Your PPR may use a different iteration statement. Use the row that matches the first loop shown in your Procedure section.
| Loop form | What controls termination | What specific value to give | How to explain the stop |
|---|---|---|---|
REPEAT UNTIL (condition) | Every variable referenced in the condition. | Values that make the condition true. | The loop stops when the Boolean expression becomes true. |
WHILE (condition) | Every variable referenced in the condition. | Values that make the condition false. | The loop continues only while the expression is true, so a false value ends it. |
FOR EACH item IN aList | The traversal position and the number of elements in aList. | The final element, or the state in which no unprocessed element remains. | The loop stops after each element has been visited once. |
REPEAT n TIMES | The repetition count n; an internal loop counter may not be visible. | The nth completed iteration. | It stops automatically after the block has executed n times. |
Index-based FOR loop | Index, limit, and update expression. | The first index value that fails the loop test. | The update changes the index until the test is no longer satisfied. |
Personalization template
Special cases
- If the first loop is nested inside another loop, analyze the first iteration statement shown in the Procedure section, not whichever loop seems most important.
- If a list length appears in the condition, name both the index and the list length or the list whose length supplies the limit.
- If the loop ends with a
RETURNorBREAKin your language, identify the condition that executes that statement and the values that make it happen. - If there is no visible control variable, explain the language-defined stopping mechanism, such as completing a fixed number of repetitions or exhausting the list.
index can be incomplete when count, limit, LENGTH(list), or another variable also appears in the termination condition.6. Question 2B — A Procedure Call That Causes Incorrect Behavior
The sample procedure assumes count does not exceed the number of scores, but it never checks that assumption. A boundary test can expose the problem.
Choose a syntactically accepted argument
The call scoreSummary(6) supplies one numeric argument, which matches the procedure’s one parameter. There is no validation that rejects 6 before the loop begins.
State the incorrect behavior
The program attempts to read a sixth element even though scoreList contains only five elements. In a language with bounds checking, the procedure raises an index error; in a language that returns an undefined value, the arithmetic or final classification becomes invalid.
Connect the failure to the loop logic
Because the condition is index > count, a count of 6 allows the body to execute while index is 1, 2, 3, 4, 5, and 6. The sixth execution accesses scoreList[6], which does not exist in this one-based list.
Failure trace for scoreSummary(6)
index | Access attempted | Valid? | Result |
|---|---|---|---|
| 1–5 | scoreList[1] through scoreList[5] | Yes | The five stored scores are added. |
| 6 | scoreList[6] | No | Out-of-range error or undefined value; no reliable result. |
Exam-ready response for Question 2B
One call that the procedure accepts is scoreSummary(6). The argument is numeric and can be assigned to count, but scoreList contains only five elements. Because the loop continues through index = 6, it attempts to evaluate scoreList[6]. That element does not exist, so the program produces an index error or an undefined calculation instead of a correct performance classification. The incorrect behavior occurs because the procedure does not verify that count is less than or equal to LENGTH(scoreList).
7. Testing Strategy and the “No Failure” Option
A systematic way to find a failing call
- List the procedure parameters and the data type or form each one expects.
- Infer the intended domain from list lengths, array bounds, divisor values, string assumptions, or selection conditions.
- Test the normal case, the lower boundary, the upper boundary, zero or empty input, and one value just outside the expected range.
- Trace the exact argument through the loop, selection, arithmetic, and list access.
- Describe the difference between expected and actual behavior in concrete terms.
Frequent failure patterns
| Procedure feature | Useful test | Possible incorrect behavior |
|---|---|---|
| Uses a list index from a parameter | 0, a negative index, or LENGTH(list) + 1 | Out-of-range access or wrong element. |
| Divides by a parameter or derived count | 0 or an empty data set | Division by zero or undefined average. |
| Assumes nonempty text | "" | Invalid substring/index operation or missing output. |
| Assumes a recognized category | A different but type-compatible string | No branch handles the value or default output is wrong. |
| Loops until a target is found | A target not present | Infinite loop or failure to return a result. |
If no accepted argument can cause incorrect behavior
The prompt permits this answer, but it must be justified with code-level protections. For example, a corrected procedure could validate count before accessing the list:
IF (count < 1 OR count > LENGTH(scoreList))
{
RETURN "Invalid count"
}Model response for the no-failure branch
It is not possible for an accepted numeric count to make the procedure behave incorrectly because the procedure first checks whether count is below 1 or above LENGTH(scoreList). Any out-of-range value returns “Invalid count” before the loop accesses scoreList or divides by count. For values in the valid range, each index from 1 through count refers to an existing element, and count is nonzero, so the procedure completes safely.
8. Question 2C — How the List Manages Complexity
The list scoreList is a data abstraction: one name represents a collection of related values, and the program can process those values with general list operations rather than separate code for every score.
State what the list represents
scoreList stores all quiz scores used by the analyzer. Each element is one score, and the list keeps the values in a single ordered collection.
Name the operation performed on the list
The List section’s second code segment traverses scoreList with FOR EACH, adds every element to total, and divides by LENGTH(scoreList) to calculate the overall average.
Explain the complexity reduction
The same loop works for any number of scores. The programmer does not need a different variable, addition statement, or length constant for each item. Adding or removing a score changes the data, not the algorithm.
Describe a no-list rewrite
For the current fixed set of five scores, the program could use five separate variables and an explicit sum. That reproduces the current output but loses scalability and requires code changes whenever the number of scores changes.
One possible fixed-size rewrite without the list
score1 <- 88
score2 <- 94
score3 <- 76
score4 <- 100
score5 <- 91
total <- score1 + score2 + score3 + score4 + score5
overallAverage <- total / 5
DISPLAY(overallAverage)List version compared with no-list version
| Design issue | With scoreList | Without a list |
|---|---|---|
| Storage | One identifier stores all related values. | Five separate identifiers are required. |
| Processing | One traversal handles every element. | The sum names every variable explicitly. |
| Changing data size | Add or remove an element; algorithm is unchanged. | Add or remove variables and edit arithmetic and divisor. |
| Risk | Lower duplication and fewer consistency errors. | More repeated code and more opportunities to omit or mismatch a value. |
9. Question 2C — Exam-Ready Explanation and Adaptation
Exam-ready response for Question 2C
The list scoreList uses data abstraction by storing all quiz scores under one identifier. The code in the List section traverses the list, adds each score to total, and uses LENGTH(scoreList) to calculate the average. This manages complexity because the same code processes any number of scores; the program does not need a separate variable and a separate addition statement for each score. Without the list, I would need variables such as score1 through score5 and would replace the traversal with total <- score1 + score2 + score3 + score4 + score5, followed by division by 5. That fixed rewrite would match the current five-score behavior, but every change in the number of scores would require changing both the variables and the calculation.
When the same behavior may be impossible without a list
If your program accepts an unknown or changing number of items at run time, a finite set of separately named variables cannot reproduce the general behavior. In that case, explain that removing the list would remove the program’s ability to store, traverse, search, filter, or update an arbitrary collection unless it were replaced with another collection abstraction.
Personalization template
What “manages complexity” should sound like
- Strong: The list lets one loop process an arbitrary number of related values, so the algorithm does not change when the collection size changes.
- Strong: The list keeps the elements ordered and allows the program to access them by index instead of maintaining many independent variables.
- Weak: The list makes the code shorter. This may be true, but it does not explain what duplicated storage or processing the abstraction replaces.
- Weak: The list stores data. Every list stores data; explain the specific data and the specific complexity reduced in your program.
10. Complete Model Response Set
Question 1
One appropriate piece of documentation is a comment block immediately above the scoreSummary procedure. The comment explains that count is the number of scores from scoreList to include, gives the intended range of count, and states that the procedure returns either “Excellent” or “Keep practicing” based on the average. Another programmer could use the documentation to select a valid argument, understand what the loop is calculating, and predict the returned result without reverse-engineering the entire procedure.
Question 2A
The variables index and count determine when the first iteration statement stops because its condition is index > count. For scoreSummary(3), count is 3 and index begins at 1. Each iteration increases index by 1. After three iterations, index equals 4, so 4 > 3 is true and the REPEAT UNTIL statement stops.
Question 2B
The call scoreSummary(6) is accepted because the procedure has one numeric parameter, but it behaves incorrectly. scoreList has only five elements. The loop still executes with index equal to 6 and attempts to access scoreList[6], which is outside the list. This can cause an index error or an undefined calculation, so the procedure does not return a reliable classification. The error occurs because the procedure does not verify that count is at most LENGTH(scoreList).
Question 2C
scoreList abstracts the program’s collection of quiz scores into one ordered structure. The code traverses the list, adds each element to total, and divides by LENGTH(scoreList). This manages complexity because one general loop works regardless of how many scores are stored. Without the list, the current behavior would require separate variables such as score1 through score5 and an explicit expression that adds all five variables and divides by 5. That version would have to be rewritten every time the number of scores changed.
Consistency check across the four answers
| Detail | Used in | Consistency requirement |
|---|---|---|
scoreSummary(count) | Q1, 2A, 2B | Same procedure name and parameter throughout. |
index > count | 2A, 2B | Termination explanation and failure trace use the same condition. |
scoreList has five elements | 2B, 2C | The failing call and abstraction explanation refer to the same collection. |
scoreSummary(3) and scoreSummary(6) | 2A, 2B | One normal case and one boundary-breaking test are clearly distinguished. |
11. Personalization Worksheet for Your Own PPR
Fill this worksheet from the code screenshots in your PPR before drafting. Exact identifiers and values are stronger than general descriptions.
| Prompt element | Write the exact detail from your PPR | How it will appear in the answer |
|---|---|---|
| Program purpose / relevant feature | ________________________ | Brief context for the code segment. |
| Documented code segment | ________________________ | “The documentation is placed above/in…” |
| Documentation content | ________________________ | Purpose, parameter/input, output, assumptions, or nonobvious logic. |
| Procedure name and parameters | ________________________ | Exact procedure call syntax. |
| First iteration statement | ________________________ | Copy the loop header or condition. |
| Variables controlling termination | ________________________ | Name every variable in the condition or loop bound. |
| Concrete normal call/input | ________________________ | Supplies values for the termination explanation. |
| Specific stopping values | ________________________ | Evaluate the condition numerically or concretely. |
| Accepted failing call, if any | ________________________ | A boundary or special-case test. |
| Incorrect behavior | ________________________ | Error, wrong output, missing output, or nontermination. |
| Exact cause of failure | ________________________ | The statement or condition that mishandles the argument. |
| List name and element meaning | ________________________ | What the collection represents. |
| List operation in part (ii) | ________________________ | Traversal, search, update, filter, aggregation, and so on. |
| No-list replacement | ________________________ | Separate variables and repeated code, or why impossible. |
12. Common Mistakes and Final Checklist
Common mistakes by prompt
| Prompt | Mistake | Correction |
|---|---|---|
| Q1 | Says only “add comments.” | Name a particular code segment and state what the documentation communicates about it. |
| Q1 | Describes user instructions but never connects them to code understanding. | Explain how another programmer uses the documentation to interpret or correctly call a segment. |
| Q2A | Names the loop counter but omits another variable in the condition. | Name every variable or expression that determines termination. |
| Q2A | Gives no specific values. | Use a concrete call/input and evaluate the stopping condition with exact values. |
| Q2B | Provides a call but not the incorrect behavior. | State the actual failure and the expected behavior. |
| Q2B | Claims a failure without tracing its cause. | Identify the exact list access, arithmetic operation, branch, or loop condition responsible. |
| Q2C | Says only that the list “makes code easier.” | Describe the repeated variables/statements avoided and how the same algorithm handles multiple elements. |
| Q2C | Describes a no-list rewrite that changes the result. | Show how the current behavior is preserved, or explain precisely why the general behavior cannot be preserved. |
Submission checklist
- Every response is written in complete sentences.
- Every program identifier matches the PPR exactly, including capitalization.
- Question 1 names one documentation artifact and one particular code segment.
- Question 2A names all termination variables and gives specific stopping values.
- Question 2A evaluates the actual loop condition, not a guessed condition.
- Question 2B includes a procedure call with the correct number and form of arguments.
- Question 2B states both the incorrect behavior and the code-level reason.
- If claiming no failing call exists, the response cites the validation or logic that guarantees correctness.
- Question 2C identifies what the list elements represent and what the code does with them.
- Question 2C explains the duplicated variables/statements needed without the list or explains why equivalent general behavior is impossible.
13. A Practical 60-Minute Plan
The exam provides 60 minutes for the four written-response prompts. The following plan leaves time to ground every answer in the PPR and still review for consistency.
| Time | Task | Output |
|---|---|---|
| 0–5 min | Scan the PPR and annotate the procedure, first loop, parameters, list, and list-processing segment. | A one-page evidence map with exact identifiers. |
| 5–15 min | Draft Question 1. | Documentation + specific code segment + programmer benefit. |
| 15–30 min | Draft Question 2A. | Loop condition + variables + concrete values + termination explanation. |
| 30–45 min | Draft Question 2B. | Specific call + actual failure + causal trace, or a justified no-failure explanation. |
| 45–57 min | Draft Question 2C. | List abstraction + complexity reduction + no-list rewrite/impossibility. |
| 57–60 min | Review all four responses. | Correct names, complete sentences, exact values, and no contradictions. |
Last-minute review questions
- Could a reader point to the exact PPR line that supports each program-specific statement?
- Did I evaluate the loop condition with values rather than merely describe the loop generally?
- Did I explain why the failing procedure call fails, not just that it fails?
- Did I identify the concrete repeated variables or statements that the list replaces?
- Are all four answers internally consistent about list length, indexing, parameter meaning, and procedure behavior?
End of detailed solution guide
Continue Your AP CSP Review
These links are included only because their exact URLs were verified in the supplied sitemap.xml.