Loop Basics
What is a loop in programming?
A structure that repeats a block of code while a condition is true.
What does i++ do in a for loop?
What is increment i by 1?
What part of the loop determines when it stops running?
What is the condition?
What is the index of the last element in an array of size 5?
What is 4?
What does .length return when used with an array?
What is the number of elements in the array?
What are the three parts of a for loop header?
What are initialization, condition, and update?
What do you call a loop that never ends?
An infinite loop.
Why is using < instead of <= safer in array loops?
What is to stay within bounds?
Fix the error:
for(int i = 1; i <= 5; i--)
Change i-- to i++ to avoid infinite loop.