The exercise-1 editor asks you to implement min, max and count. These six ask what breaks when the initial value is chosen badly and when an index has to be tracked alongside the value.
Applied Practice
6 questions · scenario driven · every answer is recorded for your teacher
Question 1 of 6Analyze
A maximum-finding method initializes int max = 0; then compares each element against it.
On which input does this fail?
Incorrect. An empty array is a separate problem, and it also breaks the arr[0] seed. It is not the only failure here.
Incorrect. It fails on all-negative data, which is exactly why the constant seed is a mutant worth naming.
Incorrect. With any positive value present, 0 is beaten immediately and the result is right.
Correct. Correct. Seeding with a constant assumes the data cannot fall below it. Seeding with arr[0] makes no such assumption.
Question 2 of 6Apply
A method must report the POSITION of the largest value, not the value itself.
What must the algorithm track?
Incorrect. A count answers a different question entirely.
Incorrect. The value alone cannot say where it came from.
Correct. Correct. The index is the stronger piece of information; tracking it alone is sufficient and avoids the two variables drifting out of step.
Incorrect. Workable but redundant, and redundancy here is a chance for the pair to disagree after a careless edit.
Question 3 of 6Analyze
Two maximum-finders differ only in using > versus >= when comparing to the best so far, and both return the largest INDEX.
Do they behave identically?
Incorrect. They agree on the maximum value but can disagree on where it is.
Correct. Correct. The distinction becomes observable precisely because an index is reported rather than a value.
Incorrect. Both compile; both are valid comparisons.
Incorrect. Emptiness affects both identically and is not what separates them.
Question 4 of 6Apply
A method computes the average of an int array as sum / arr.length, with both operands int.
What goes wrong?
Correct. Correct. The fix is to cast before dividing, not after: casting the result of an int division has already lost the remainder.
Incorrect. Overflow requires very large totals and is a separate concern.
Incorrect. The count of elements is the right denominator for a mean.
Incorrect. It is correct only when the total divides evenly, which is the exception rather than the rule.
Question 5 of 6Evaluate
A method must decide whether every element satisfies a condition.
Which structure is correct and efficient?
Incorrect. Correct results but it always scans the whole array, even after a failure has settled the answer.
Incorrect. One element says nothing about the rest.
Incorrect. That answers "does any element satisfy it", a different question.
Correct. Correct. A universal claim is refuted by one counterexample, so the loop hunts for the counterexample.
Question 6 of 6Analyze
An array algorithm must run on an array that might have length 0.
Which algorithm needs a guard before it starts?
Incorrect. True of the loops, but the arr[0] seed happens before the loop and still throws.
Incorrect. The accumulator starts at 0 and the loop body never runs. The answer is meaningfully 0.
Correct. Correct. Any algorithm that reads an element BEFORE the loop needs an element to exist.
Incorrect. Same as summing: a zero-initialized counter is already the right answer.
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