AP® Computer Science A glossary

Statement execution count

Course: AP® Computer Science A Shows up in: Unit 2: Selection and Iteration

The number of times a statement is executed by a program, usually calculated informally by tracing and analyzing the loops.

Appears in the course and exam description (CED): 2.12.A.1

In a loop with n iterations, the body runs n times and the Boolean expression is evaluated n + 1 times. Nested loops with fixed bounds multiply their counts.

int count = 0;
for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
        count++;
    }
}
System.out.println(count);

Output:

12
Learn it properly, with a checkpoint 2.12 Informal Run-Time Analysis

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure