Results

Cambridge November 2026 results: AS & A Level on 7 January 2027, IGCSE and O Level on 14 January 2027.

Source: Cambridge International
STUDY GUIDE

AP Computer Science A Free-Response Practice in Java

For an AP Computer Science A free response, read the method contract and trace a small example before writing Java. College Board lists four free-response questions in 90 minutes, with answers typed in Bluebook. This original exercise lets you practice array traversal.

Book your free 30-minute demo

Updated November 2026.

By LearnAllStudents Editorial Team. Source check dates are listed below.

Official resources

Try the original task

Write countRises(int[] readings). Return the number of times a reading is strictly greater than the immediately previous reading. Assume readings is non-null. For the values [2, 2, 5, 4, 7] your method should return 2.

Worked example

int countRises(int[] readings) {
    int count = 0;
    for (int i = 1; i < readings.length; i++) {
        if (readings[i] > readings[i - 1]) {
            count++;
        }
    }
    return count;
}

The first pair 2 and 2 is equal, so it contributes nothing. Only 2 to 5 and 4 to 7 increment the count. Starting at 1 gives each element a previous index.

Test the edges before submitting

An empty array and a one-element array both return zero because the loop never starts. The array [7, 5, 5] returns zero. Check that your condition uses a strict comparison and that the count is returned after the loop.

How a tutor would approach this

Bring your Java method, an input and the expected output. Trace both a typical case and an edge case.

Frequently asked questions

Does this apply to AP Computer Science Principles?

This exercise targets Java practice for AP Computer Science A. Check the separate Principles exam requirements.

Why start the index at one?

Index zero has no previous element, and the task compares adjacent values.

Should equal values count as rises?

No. Strictly greater values count.

Is the exercise an official free-response question?

It is original practice. Use College Board materials for official questions and scoring guidance.

A USEFUL NEXT STEP

Keep exploring your course

Official sources

Related pages

Try a free 30-minute demo

Work through a question with a tutor. No payment needed.

Request a free 30-minute demo
YOUR NEXT STEP

A little clarity starts with 30 minutes.

Share your goals, explore a question and discuss a learning plan. Request your free 30-minute demo class — no payment needed. Tutor and time are confirmed separately.

Book your free 30-minute demo
Book free demoWhatsApp us