Nearly every wrong answer here comes from reading assignment as a permanent relationship instead of a one time copy. Trace the values in order.
Applied Practice
6 questions · scenario driven · every answer is recorded for your teacher
Question 1 of 6Trace
Predict first: what is stored in b when the last line runs?
What does this segment display?
a <- 5
b <- a
a <- 9DISPLAY b
Correct. The second line copies the value of a at that moment, which is 5. Changing a afterwards does not reach back into b.
Incorrect. 9 assumes b tracks a. Assignment copies a value once, it does not link the variables.
Incorrect. 14 adds the two values, but no addition appears in the segment.
Incorrect. DISPLAY b shows the value stored in b, not the name of another variable.
Question 2 of 6Trace
What does this segment display?
x <- 3
y <- 4
x <- y
y <- x
DISPLAY x + y
Incorrect. 6 would require both to end at 3, but the first swap step moved x to 4.
Incorrect. 3 is the original x, which was overwritten on the third line.
Incorrect. 7 is the sum of the original values, but both variables changed before the display.
Correct. x becomes 4, then y is set from the new x, which is also 4. The sum is 8.
Question 3 of 6Debug
A student wants to swap the values in p and q.
Why does this segment fail, and what is missing?
p <- q
q <- p
Incorrect. It runs without error and leaves both variables holding the original q, which is not a swap.
Incorrect. Reversing the lines loses q instead of p. The order is not the defect.
Correct. The first line destroys the original p, so the second line copies the new value back. A temp holding one original value first is the standard fix.
Incorrect. A variable on both sides is entirely legal, and it is how accumulation works.
Question 4 of 6Apply
Which sequence correctly swaps the values of m and n?
Incorrect. This is the failed swap. The original m is gone after the first line.
Correct. Saving one value before overwriting it is the whole point of the temporary variable, and this order preserves both.
Incorrect. This copies m into n, then copies the new n back into m, leaving both holding the original m.
Incorrect. The second line copies the combined sum rather than the original m.
Question 5 of 6Trace
What does this segment display?
total <- 0
total <- total + 5
total <- total + 5DISPLAY total
Correct. Each line reads the current total, adds 5, and stores the result back, so two updates give 10.
Incorrect. 55 would come from joining the digits as text rather than adding numbers.
Incorrect. 0 is the starting value, before either update runs.
Incorrect. 5 is the value after the first update only.
Question 6 of 6Analyze
A program uses a variable named x for a student count, a temperature, and a list index in different sections.
Which is the strongest specific objection?
Incorrect. Reusing a name is legal. It is a clarity problem, not a rule violation.
Incorrect. Nothing here causes an error. That is what makes it easy to leave in place.
Incorrect. Variable naming has no effect on execution speed.
Correct. Names are how a reader tracks meaning. One name carrying three unrelated meanings destroys that, and the cost lands on whoever debugs it.
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed.
Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Typically responds within 24 hours
✓
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
34.8% of Tanner’s CSP students score 5s. The national average is 9.6%.
I’m a Student
I’m a Teacher
✓Free AP CSP Big Ideas cheat sheet (PDF)
✓Daily practice questions covering all 5 Big Ideas
✓Create Task tips that actually work — from a real AP teacher
✓Free class codes with student progress tracking
✓3 full practice exams + Top 100 questions for your class
✓Create Task guidance and pseudocode reference sheets
Which AP CS exams are you prepping for?
✓
You’re in!
Your Big Ideas cheat sheet is on its way.
No thanks, I’ll figure it out myself
Avg student improvement: 2+ score levels | Real AP teacher, not just a tutor
AP Cybersecurity — National Launch 2026–27
Get Early Access to AP Cyber
AP Cyber launches nationally fall 2026. Get in early to help shape the course — start free with Unit 1 and the free teacher gradebook.
✓
You’re in — you’re on the AP Cyber early-access list!
Tanner will follow up personally within 48 hours. Your feedback will directly shape what gets built.
Step 1 of 4
Early Access — Limited Spots
Who are you?
Are you a teacher or a student?
I’m a Teacher
I’m a Student
Free to start — Unit 1 and the teacher gradebook are always free, no credit card.
Founding teachers unlock all 5 units and get direct input on what we build.
Not interested right now
Step 2 of 4
Your School
Tell us about your class
Other AP CS courses you teach
Your Situation
Tell us about yourself
Step 3 of 4
Classroom Needs
What does your classroom need? (select all that apply)
How You Study
What would help you most? (select all that apply)
Step 4 of 4
Almost Done
Where should we send your early-access details?
Free gradebook + Unit 1 | Your feedback shapes the course | Built by a real AP teacher