AP Computer Science A Flashcards: while Loops
Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026
Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.
What is an iteration statement?
An iteration statement changes the flow of control by repeating a segment of code zero or more times as long as the Boolean expression controlling the loop evaluates to true.
Card 1 of 10
All Flashcards (10)
What is an iteration statement?
An iteration statement changes the flow of control by repeating a segment of code zero or more times as long as the Boolean expression controlling the loop evaluates to true.
What is a `while` loop?
A `while` loop is a type of iterative statement where the Boolean expression is evaluated before each iteration of the loop body, including the first.
When is it appropriate to use an iterative process?
An iterative process is required when a segment of code must be repeated to achieve a desired result.
What are the two main goals when developing code with `while` loops?
The goals are to represent iterative processes and to determine the result of these processes once the loop terminates.
What happens if a `while` loop's Boolean expression always evaluates to true?
This creates an infinite loop, where the loop's code segment repeats endlessly.
When is the Boolean expression in a `while` loop evaluated?
The Boolean expression is evaluated before each iteration of the loop body, including the first one.
How do iteration statements, like `while` loops, change the flow of control?
They change the normally sequential flow of control by causing a segment of code to be repeated as long as a condition is met.
Is it possible for the body of a `while` loop to never execute?
Yes, if the Boolean expression evaluates to false before the very first iteration, the loop body will be repeated zero times.
What is an infinite loop?
An infinite loop occurs when the Boolean expression in an iterative statement always evaluates to true.
What controls the repetition in an iteration statement?
A Boolean expression controls the repetition; the code segment is repeated as long as this expression evaluates to true.