---
title: "AP Computer Science A Guided Practice"
description: "Fiveable has 5,505 AP Computer Science A multiple-choice practice questions across 4 units, plus 3 stimulus-based question sets built around a source. Practice one unit or topic at a time."
canonical: "https://fiveable.me/ap-comp-sci-a/guided-practice"
type: "guided-practice"
subject: "AP Computer Science A"
---

# AP Computer Science A Guided Practice

## Overview

Fiveable has 5,505 AP Computer Science A multiple-choice practice questions across 4 units, plus 3 stimulus-based question sets built around a source. Practice one unit or topic at a time.

## Practice Questions by Unit

- Unit 1 – Using Objects and Methods: 1,826 multiple-choice questions
- Unit 2 – Selection and Iteration: 1,179 multiple-choice questions, 2 stimulus sets
- Unit 3 – Class Creation: 803 multiple-choice questions
- Unit 4 – Data Collections: 1,697 multiple-choice questions, 1 stimulus set

## Sample Question

**Countdown Accumulator with while Loop**

> Consider the following Java code.
>
> ```java
> public class CountDown {
>     public static int compute(int n) {
>         int total = 0;
>         int k = n;
>         while (k > 0) {
>             total += k;
>             k -= 2;
>         }
>         return total;
>     }
>
>     public static void main(String[] args) {
>         int result = compute(7);
>         System.out.println(result);
>
>         int x = 0;
>         int limit = 4;
>         while (x < limit) {
>             System.out.print(x + " ");
>             x++;
>         }
>     }
> }
> ```

Source: Fiveable fictional Java practice code aligned to the AP Computer Science A Fall 2025 CED

What is printed to the console as a result of executing the main method in the code shown?

- (A) 16
0 1 2 3
- (B) 16
0 1 2 3 4
- (C) 12
0 1 2 3
- (D) 16
1 2 3 4

**Answer: (A)** Tracing compute(7): iteration 1 k=7, total=7, k becomes 5; iteration 2 k=5, total=12, k becomes 3; iteration 3 k=3, total=15, k becomes 1; iteration 4 k=1, total=16, k becomes -1; condition -1>0 is false, loop exits, returns 16. println(16) prints '16' then newline. Second loop: x starts at 0, limit=4. Prints '0 ', '1 ', '2 ', '3 ', then x=4 fails x<4, loop ends. Full output is '16' on line 1 and '0 1 2 3 ' on line 2.

## Related Practice

- [Methods FRQ practice: Methods and Control Structures question questions scored by part](/ap-comp-sci-a/frqs/methods-and-control-structures)
- [Class Design FRQ practice: Class Design question questions scored by part](/ap-comp-sci-a/frqs/class-design)
- [ArrayList FRQ practice: Data Analysis with ArrayList question questions scored by part](/ap-comp-sci-a/frqs/arraylist)
- [2D Array FRQ practice: 2D Array question questions scored by part](/ap-comp-sci-a/frqs/2d-array)
- [AP Computer Science A unit tests: a timed practice test for every unit](/ap-comp-sci-a/unit-test)
- [AP Computer Science A full-length practice exams](/ap-comp-sci-a/practice-exams)
- [AP Computer Science A subject hub](/ap-comp-sci-a)

## About This Document

Canonical Fiveable pages are available as Markdown at the same path plus `.md`.

- [llms.txt](https://fiveable.me/llms.txt): index of Fiveable's sections and URL patterns
- [llms-full.txt](https://fiveable.me/llms-full.txt): complete subject and unit listing
- [MCP server](https://fiveable.me/mcp): call Fiveable as tools instead of fetching pages (`https://fiveable.me/api/mcp`)
- [MCP server for AP teachers](https://fiveable.me/mcp/teachers): a teacher's classes, assignments and AP-rubric grading (`https://fiveable.me/api/mcp/teacher`)
