Module 6 Flashcards
for loop is pre-test loop
True
Each pass through a loop is called a/an ________
iteration
In counter-controlled repetition, it requires the following except _________
- the name of a control variable
- the loop-continuation condition that tests for the initial value of the control variable to determine when to exit
- the control variable to be incremented (or decremented) each time through the loop
- the initial value of the control variable
the loop-continuation condition that tests for the initial value of the control variable to determine when to exit
What is correct syntax of for loop?
for(initialization; condition; increment/decrement)
The loop iterates while the condition is true.
True
Values that are used to end loops are referred to as _____ values.
Sentinel
The while loop evaluates the test expression inside the parenthesis {} if it is true.
False
When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.
True
A continue statement causes execution to skip to ______
the next iteration of the loop
Which of the following loop constructs perform the statement at least once?
do-while
Which looping process is best used when the number of iterations is known?
for
The statement i++; is equivalent to _________
i = i + 1;
When using do-while loop is that we need to use __________ statement inside while loop so that the loop variable gets changed on each iteration, and at some point condition returns false.
update statement/increment or decrement
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
braces { }
If the test occurs at the beginning of the loop, the type of loop is called a post-test loop or entrance-controlled loop.
True
Can a for loop contain another for loop?
Yes
A while loop that never stops is said to be the infinite while loop, when we give the condition in such a way so that it never returns ___.
False
Which of the following is an entry-controlled loop?
- for only
- do-while only
- for and while
for and while
When the condition becomes true, program control passes to the line immediately following the loop.
False
What’s wrong? while( (i < 10) && (i > 24))
the test condition is always false
What is the way to suddenly come out of or quit any loop in C++ language?
break; statement
Given that the increment/decrement operator is ++/– and the first testing is true in a loop, the formula to compute for the number of loops when using the relational operator <= is |TV – IV| + 1
True
goto statement allows making an absolute jump to another point in the program.
True
When a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.
True