Save
AP Computer Science A
Unit 4: Iteration
4.2 for Loops
Save
Share
Learn
Content
Leaderboard
Share
Learn
Cards (94)
The initialization part of a `for` loop sets the initial value of the loop
variable
What is the purpose of the increment statement in a `for` loop?
Updates loop variable
A `for` loop combines initialization, condition, and increment in one
line
The condition in a `for` loop determines whether the loop should
continue
A `
while
` loop separates initialization, condition, and increment.
True
The condition in a `for` loop is a
Boolean
expression that determines whether the loop should continue.
True
`
for
` loops are suitable when the number of iterations is known.
True
What is the syntax of a `for` loop in Java?
for (initialization; condition; increment)
What are the three key components of a `for` loop in Java?
Initialization, condition, increment
What is the primary purpose of a `for` loop in Java?
Execute code repeatedly
What are the three main parts of a `for` loop in Java?
Initialization, condition, increment
What are the three key components of a `for` loop in Java?
Initialization, condition, increment
What are `for` loops used for in Java?
Executing code repeatedly
How many times does the example `for` loop iterate: `for (int i = 0; i < 10; i++)`?
Ten times
What is the Boolean expression in a `for` loop called?
Condition
What are the three main parts of a `for` loop in Java?
Initialization, condition, increment
The increment expression in a `for` loop updates the loop
variable
`while` loops are ideal when the number of iterations depends on
conditions
The three main parts of a `for` loop are
initialization
, condition, and increment.
True
The initialization statement in a `
for
` loop is executed only once, before the loop begins.
True
Order the three parts of a `for` loop in Java:
1️⃣ Initialization
2️⃣ Condition
3️⃣ Increment
The increment expression in a `for` loop updates the loop
variable
The `
for
` loop combines initialization, condition, and increment into a single line of code.
True
Match the loop type with its feature:
`for` loop ↔️ Combines initialization, condition, and increment
`while` loop ↔️ Separates initialization, condition, and increment
The condition statement in a `for` loop checks if the loop should continue
executing
The condition in a `for` loop is a
Boolean
expression.
True
Arrange the components of a `for` loop in their correct order:
1️⃣ Initialization
2️⃣ Condition
3️⃣ Increment
4️⃣ Loop body
A `while` loop is suitable when the number of iterations is known.
False
What are the three main parts of a `for` loop in Java?
Initialization, condition, increment
The initialization statement in a `for` loop sets the initial value of the loop
variable
Match the loop type with its structure:
`for` loop ↔️ Combines initialization, condition, and increment
`while` loop ↔️ Separates initialization, condition, and increment
`for` loops are best used when the number of iterations is known in
advance
The loop variable in a `for` loop can be of any primitive data type or a reference type, such as a
String
`while` loops are ideal when the number of iterations depends on conditions.
True
Match the loop type with its use case:
`for` loop ↔️ Iterations known in advance
`while` loop ↔️ Conditions-based iterations
What are the three key components of a `for` loop in Java?
Initialization, Condition, Increment
What does the initialization statement do in a `for` loop?
Sets the initial value
What is the purpose of the condition statement in a `for` loop?
Determines if the loop continues
Match the loop component with its feature:
`for` loop body ↔️ Enclosed in curly braces {}
`while` loop body ↔️ Control components are separate
After each execution of the loop body in a `for` loop, the
increment
expression is evaluated before the loop continues.
True
See all 94 cards