2010 AP CSA FRQ 3: Trail
Topic: 2D Arrays & Elevation Analysis
Skills: 2D array traversal, finding differences, boolean logic
Unit: Unit 4 (Data Collections) (2025-2026 AP CSA)
Points: 9 | Time: ~22 minutes
Part (a)
Write the isLevelTrailSegment method that checks if a trail segment is level.
Solution
public boolean isLevelTrailSegment(int start, int end)
{
for (int i = start; i < end; i++)
{
if (Math.abs(markers[i] - markers[i + 1]) > 10)
{
return false;
}
}
return true;
}Part (b)
Write the isDifficult method that determines if the trail is difficult based on elevation changes.
Solution
public boolean isDifficult()
{
int count = 0;
for (int i = 0; i < markers.length - 1; i++)
{
if (Math.abs(markers[i] - markers[i + 1]) >= 30)
{
count++;
}
}
return count >= 3;
}Key Concepts
Common Mistakes
Official Resources
Author: Tanner Crow - AP CS Teacher, 11+ years