1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
repetition control structures
These are Java statements that allows us to execute specific blocks of code a number of times.
Loop Body
Within a looping strucure, a Boolean expression is evaluated. If it is true, a block of statements called the _____ executes and the Boolean expression is evaluated again.
iteration
One execution of any loop is called an _____.
initialization, loop test, loop body, loop update
What are the four loop sections?
initialization
This step occurs prior to the loop. Variables that need to be initialized are given values prior to the first time the loop test is evaluated.
loop test
This statement determines whether the loop body will be executed. When this section is false, the loop body is not executed. If this statement is always true, an infinite loop results, unless the loop is exited with a break or return statement.
loop body
The statements that are executed each time the loop test evaluates to true.
loop update
The statements that affect values in the loop test. These statements ensure that the loop will eventually terminate. Values of variables in the loop test will be changed by the update statements.
while, do while, for loop
What are the three types of repetition control structures?
while loop
The statement or block of statements that is repeated as long as some condition is satisfied.
do while loop
This loop is similar to the while-loop. The statements inside this loop are executed several times as long as the condition is satisfied.
for loop
It is an entry-controlled loop that allows a user to execute a block of a statement(s) repeatedly with a known number of times on the basis of a specified condition.
initialization
for(initialization; test_condition; StepExpression){}
in this syntax, which statement tell where the loop start?
test_condition
for(initialization; test_condition; StepExpression){}
in this syntax, which statement tell where the loop ends?
StepExpression
for(initialization; test_condition; StepExpression){}
in this syntax, which statement you can increment or decrement the loop?
continue statement
This is mostly used inside loops. Whenever it is encountered inside a loop, control directly jumps to the beginning of the loop for next iteration, skipping the execution of statements inside loop’s body for the current iteration.
break statement
It is used to come out of the loop instantly. Whenever this statement is encountered inside a loop, the control directly comes out of loop and the loop gets terminated for rest of the iterations.
loop
It is a structure that allows repeated execution of a block of statements.